How to figure out the users sid?

  • Hi!

    Is there a way find out a user's sid with TSQL?  (local one or a local group, like BUILTIN\Administrators)

    Thanks.

  • If a login is already created for that user, you can use:

    SELECT name, sid FROM master..sysxlogins WHERE (xstatus & 4) = 4

    The tricky part would be now to convert the varbinary value (which looks like this: 0x010500000000000515000000B644E4233B245E6907E53B2BEB030000) to a more readable thing (e.g. "S-1-5-21-602162358-1767777339-725345543-1003").

    Razvan

  • Hi,

    You can also do it like this:

    select suser_sid('BUILTIN\Administrators')

    Regards,

    JP

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply