Pages

Search This Blog

Wednesday, October 8, 2008

SQL server remap user - blank Login name

i come across this situation: my customer backup a db and i restore in our development server. The login user have empty "Login name". Hence, i'm not able to connect using this user name.



finally, i found out that we can use sp_change_users_login to map with login name.

for my case, my database name is HHotel, user login will be 'lam' and password 'l!a2m#'

USE HHotel;
GO
EXEC sp_change_users_login 'Auto_Fix', 'lam', NULL, 'l!a2m#';
GO

It's fixed after run above script.

For more example: http://msdn.microsoft.com/en-us/library/ms174378.aspx