SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 mapping login to db error
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Hommer
Aged Yak Warrior

786 Posts

Posted - 01/30/2013 :  11:14:15  Show Profile  Reply with Quote
Hi,


We have a login on the dev server which mirrors the login on the production server, but I can't get it to mapped to another db in the same server group on the dev. When I edit the properties of the login in 'User Mapping", I check the map to 2nd db, and I get the following error:


Create failed for User 'myLogin_name'. (Microsoft.SqlServer.Smo)

User, group, or role 'mylogin_name' already exists in the current database. (Microsoft SQL Server, Error: 15023)

I know that user exists as it was listed under that db's security, users.

Thanks!

TG
Flowing Fount of Yak Knowledge

USA
6062 Posts

Posted - 01/30/2013 :  11:32:56  Show Profile  Reply with Quote
sounds like that user exists in the database but is not sync'd to the login (sids don't match). That can happen when the database is restored from a different server.

see if the user exist by:
use <database>
select * from sysusers where name = 'mylogin_name'

if its there then sync the user to the login with:
alter user [myLogin_name] with login = [myLogin_name]


Be One with the Optimizer
TG
Go to Top of Page

Hommer
Aged Yak Warrior

786 Posts

Posted - 01/30/2013 :  12:02:07  Show Profile  Reply with Quote
That worked!

Thanks, TG!
Go to Top of Page

TG
Flowing Fount of Yak Knowledge

USA
6062 Posts

Posted - 01/30/2013 :  13:25:52  Show Profile  Reply with Quote
Cool - You're welcome.

Be One with the Optimizer
TG
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000