question

Kev Riley avatar image
Kev Riley asked

Resolving orphaned users

With the announced deprecation of sp_change_users_login, how are we to use ALTER LOGIN to fix orphaned users, in the same way that I used to use

sp_change_users_login 'update_one','mary','mary'


Edit: Matt Whitfield pointed out I should have been talking about ALTER USER. My bad!

sql-server-2008t-sqldeprecated
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Matt Whitfield avatar image
Matt Whitfield answered

You want to use ALTER USER, rather than ALTER LOGIN.

The equivalent would be

ALTER USER mary
WITH LOGIN = mary
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Tim Benninghoff avatar image
Tim Benninghoff answered

From BOL, in SQL Server 2008 you can use the WITH LOGIN option of ALTER USER in order to fix an orphaned user. This functionality is also available in 2005.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.