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
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Attach Database - User Problem

Author  Topic 

SamC
White Water Yakist

3467 Posts

Posted - 2003-05-06 : 22:20:19
After successfully attaching a database, I cannot create or add the users to the SECURITY/LOGINS folder - I get the error "user already exists".

The users do exist under the database / users folder.

How do I resolve this situation?

Sam

chadmat
The Chadinator

1974 Posts

Posted - 2003-05-07 : 00:32:43
http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=12615

-Chad

http://www.clrsoft.com

Software built for the Common Language Runtime.
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2003-05-07 : 07:08:30
Thanks Chad,

Ran your procedure into master, logged in as sa in the attached database. I get the following error:
Server: Msg 15063, Level 16, State 1, Procedure sp_change_users_login, Line 104
The login already has an account under a different user name.
Server: Msg 15291, Level 16, State 1, Procedure sp_change_users_login, Line 96
Terminating this procedure. The Login name 'dlaweb' is absent or invalid.


Sam

Go to Top of Page

chadmat
The Chadinator

1974 Posts

Posted - 2003-05-07 : 11:58:18
The appropriate logins have to exist. You need to add the logins (Don't try to assign them any db access), then run the proc.

-Chad

http://www.clrsoft.com

Software built for the Common Language Runtime.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-05-07 : 12:32:12
To use sp_change_users_login, the logins do not have to exist already. If they do not exist, they get created with a blank password though. I have a stored procedure which transfers passwords (just do a forum search on isp_Transfer_Passwords if you are interested).

Tara
Go to Top of Page

chadmat
The Chadinator

1974 Posts

Posted - 2003-05-07 : 13:00:50
I think it does Tara, from BOL:

quote:

Update_One Links the specified user in the current database to login. login must already exist. user and login must be specified




-Chad

http://www.clrsoft.com

Software built for the Common Language Runtime.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-05-07 : 13:09:31
Sorry, I was thinking about the AUTO_FIX option. Forgot that your script runs UPDATE_ONE and not AUTO_FIX like mine.

Tara
Go to Top of Page
   

- Advertisement -