dbTalk Databases Forums  

user_sid

microsoft.public.sqlserver.setup microsoft.public.sqlserver.setup


Discuss user_sid in the microsoft.public.sqlserver.setup forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
partymonkey
 
Posts: n/a

Default user_sid - 05-04-2004 , 06:26 PM






What does the SQL command user_sid do? Where does it get it's data? It is currently used in sp_change_users_login, but I cannot find any documentation on this function

Thank


Reply With Quote
  #2  
Old   
Sue Hoegemeier
 
Posts: n/a

Default Re: user_sid - 05-04-2004 , 09:35 PM






It's not documented (but suser_sid is documented). If you
look at what it's doing, it's essentially just executing:
select user_sid(suser_sid('SomeUser'))
which returns the sid. The sids are stored in sysusers,
sysxlogins.

-Sue

On Tue, 4 May 2004 16:26:02 -0700, "partymonkey"
<anonymous (AT) discussions (DOT) microsoft.com> wrote:

Quote:
What does the SQL command user_sid do? Where does it get it's data? It is currently used in sp_change_users_login, but I cannot find any documentation on this function.

Thanks


Reply With Quote
  #3  
Old   
partymonkey
 
Posts: n/a

Default Re: user_sid - 05-05-2004 , 06:56 PM



I acutally figured this out. You are correct that in sp_change_users_login it is used as such "user_sid(suser_sid('SomeUser'))"

But if you also look in sp_grantdbaccess, you'll see it used as such "user_sid(user_id('SomeUser'))". So this is actually an MS bug in sp_change_users_login

"user_sid" takes a uid from sysusers of the current database and returns the sid. But in sp_change_users_login is passing in a sid from syslogins, which is incorrect

In my case, the sid that was being passed into sp_change_users_login was implicitly being converted to a smallint (because it's expecting a uid, which is a smallint) which turned out to be a valid uid and I was getting a duplicate sid error

Thanks

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.