Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Old Forums
 CLOSED - General SQL Server
 Attaching database

Author  Topic 

X-Factor
Constraint Violating Yak Guru

392 Posts

Posted - 2006-09-07 : 17:17:01
Hi,

I find that when I attach a database and create a login for it, SQL Server will give an error that a user already exists with the name of the login.

But if I try and delete the user it may be the owner of some objects. So how do I re-create an old login for the newly attached database without getting the conflict?

Cheers, XF.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-09-07 : 17:22:54
Prior to doing the attach, add the account. Then attach the database and finally unorphan the account.

You could also do it via this method prior to the attach. You don't have to do the unorphan part of you use this method.
http://www.sqlmag.com/articles/index.cfm?articleid=16090&

Tara Kizer
Go to Top of Page
   

- Advertisement -