Big fat disclause: Microsoft does not
Support any modifications to your SharePoint databases. That's not
Say they won't support your SharePoint site, but if this operation
Breaks your server, Microsoft won't help you. I'm not responsible
The results, either, while we're on the subject of passing the buck.
Back up your database.
Okay, now that we 've gotten that mumbo-jumbo out of the way, here's the code.
Declare @ Login Varchar (40), @ systemid Varbinary (128)
Declare Curusers Cursor Local For
Select Tp_login, tp_systemid From Userinfo Where Tp_deleted = 0
Open Curusers
Fetch Next From Curusers Into @ Login, @ systemid
While @ Fetch_status = 0
Begin
Print 'Resetting user' + @ Login +'To New Sid'
Print Suser_sid (@ login)
Update Userinfo
Set Tp_systemid = suser_sid (tp_login) Where Current Of Curusers
Fetch Next From Curusers Into @ Login, @ systemid
End
Close Curusers
Deallocate Curusers
Go