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;
EXEC sp_change_users_login 'Auto_Fix', 'lam', NULL, 'l!a2m#';

It's fixed after run above script.

For more example:


Corobori said...

Your sample helped me. Thanks.

Anonymous said...

That's some righteous code there! Thanks, it helped me.

Anonymous said...

I would like to exchange links with your site
Is this possible?

Anonymous said...

great post, just the kind of information I was looking for