Converting a users SID
From: Tobias Jonasson (t.jonasson@imagon.se)
Date: 05/27/02
- Next message: Lance B: "auditing user "sa" failed attemps"
- Previous message: Marcus Michaels: "Login failure"
- Next in thread: Erland Sommarskog: "Re: Converting a users SID"
- Reply: Erland Sommarskog: "Re: Converting a users SID"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: Tobias Jonasson <t.jonasson@imagon.se> Date: Mon, 27 May 2002 08:17:45 -0700
I want to convert the user SID to varChar, I have successfully converted
a local SQL users SID to varChar, se the code below.
Q: SELECT SUSER_SID('MyUser')
A: 0x15489420B0A30543B2CD88D4EE4E6C37
Q: SELECT SUSER_SNAME(0x15489420B0A30543B2CD88D4EE4E6C37)
A: MyUser
Q: SELECT Convert(varChar, SUSER_SID('MyUser'))
A: H" °£C²ÍˆÔîNl7
Q: SELECT SUSER_SNAME(SUSER_SID('MyUser'))
A: MyUser
Q: SELECT SUSER_SNAME(convert(varBinary, convert(varChar,
SUSER_SID('MyUser'))))
A: MyUser
Q: SELECT SUSER_SNAME(convert(varBinary, 'H" °£C²ÍˆÔîNl7'))
A: MyUser
But when I'm using the same code for a NT user I get the following
result:
Q: SELECT SUSER_SID('MYDOMAIN\NTUSER')
A: 0x01050000000000051500000092580A58DE26026F7B204646EF030000
Q: SELECT
SUSER_SNAME(0x01050000000000051500000092580A58DE26026F7B204646EF030000)
A: MYDOMAIN\NTUSER
Q: SELECT Convert(varChar, SUSER_SID('MYDOMAIN\NTUSER'))
A:
Q: SELECT SUSER_SNAME(SUSER_SID('MYDOMAIN\NTUSER'))
A: MYDOMAIN\NTUSER
Q: SELECT SUSER_SNAME(convert(varBinary, convert(varChar,
SUSER_SID('MYDOMAIN\NTUSER'))))
A: MYDOMAIN\NTUSER
Q: SELECT SUSER_SNAME(convert(varBinary, ''))
A: NULL
Why is that?
I have tried with a few different NT Users but with the same result. Why
can't I convert a NT Users SID to varChar?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
- Next message: Lance B: "auditing user "sa" failed attemps"
- Previous message: Marcus Michaels: "Login failure"
- Next in thread: Erland Sommarskog: "Re: Converting a users SID"
- Reply: Erland Sommarskog: "Re: Converting a users SID"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]