Hello,
A system that houses an app and it's database was restored.
The database called testdb has a user called testdbuser. When I check
the users for this db - it shows testdbuser - the properties show the
Login Name as <none> after the restore.
In the Security Folder - testdbuser does not exist. I tried to
recreate it and give the the correct password and database access.
However, when I do that - it says the 'users already' exists.
It will not let me drop testdbuser from the db because it is the owner
of tables.
However when the app tries to access it - it says:
Cannot open database requested in login 'testdb'. Login fails.
When I try to login with query analyzer, I get
Login failed for testdbuser
Previous to this restore - it used to work.
How can I rename the login to 'testdbuser' as it was previously?
Any other suggestions?
Thanks,
Tmuld
Tibor Karaszi - 03 Mar 2008 16:25 GMT
Check out sp_change_users_login, documented in Books Online. You also might want to Google
sp_help_revlogin, for an alternate way to handle this situation.

Signature
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
> Hello,
>
[quoted text clipped - 26 lines]
>
> Tmuld
Adi - 03 Mar 2008 16:32 GMT
> Hello,
>
[quoted text clipped - 26 lines]
>
> Tmuld
There is a difference between login and user. Make sure that the
login exists on the new server. If the login doesn't exist, then
create it on the new server. If the login is SQL Server login, you'll
also have to run sp_change_users_login 'update_one', 'UserName',
'LoginName'. Of course you have to specify the real username and
loginname. You have to run this procedure in the database TestDB. I
recommend that you'll read about sp_change_users_login at BOL.
Adi