Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update SID in SQL Server

Tags:

sql-server

sid

My user was deleted from the Active Directory and recreated. When running the select suser_sid, I notice that it shows the old SID.

Is there a way to update it to my new SID? I am DBA Admin on SQL Server

like image 683
Rick Avatar asked Sep 26 '26 23:09

Rick


1 Answers

You can't ALTER the SID of a LOGIN, no (notice there is no SID option in ALTER LOGIN (Transact-SQL)). You'll need to recreate the LOGIN by dropping the old one and recreating it and giving it the old permissions.

This will orphan any associated USERs, so you will then need to remap them to the new LOGIN using ALTER USER in the databases it has a login in:

ALTER USER [Domain\User] WITH LOGIN = [Domain\User];
like image 101
Larnu Avatar answered Sep 29 '26 19:09

Larnu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!