Friday 19 April 2013

Enable, Disable or Rename login SA in SQL Server

You can’t change the permission of SA login in SQL Server:
change_permissions_failed_for_user_sa
You also can’t drop the login SA:
drop_failed_for_user_sa
You can disable the login SA:
ALTER LOGIN sa DISABLE
GO

…or enable it:
ALTER LOGIN sa ENABLE
GO

You can rename SA login (renaming will not change the default SID which is 0×01):
ALTER LOGIN sa WITH NAME = [new_name];
To check the name of a login when you know the SID, run the following query:
SELECT * FROM sys.syslogins WHERE sid = 0x01

No comments:

Post a Comment