Renaming logins in SQL Server 2005…

Did you know that SQL Server 2005 supports renaming logins? This can be done via ALTER LOGIN statement. I posted a sample about renaming sa login and disabling it before. But it is probably not obvious if you can do it for all logins. Ex:

ALTER LOGIN sqluser WITH NAME = [newuser];

You can also use this to rename Windows Logins that map to same SID.

See the ALTER LOGIN topic [ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/e247b84e-c99e-4af8-8b50-57586e1cb1c5.htm] in Books Online for more details. The topic can also be found in MSDN at http://msdn2.microsoft.com/ms245841.