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)
 Adding a user to a Login

Author  Topic 

Richard210363
Starting Member

2 Posts

Posted - 2005-09-10 : 09:48:21
Hi there,
I was sent a database that had been detatched from it's server so tha I could work on it. I attatched the database to my SQL Server 2000.
However the database has a User (User1) that is not attatched to any Logins on my server. I tried creating the Login of the same name in my server and then using the SQL Server Login Properties of the Login to give the Login Database Access. However, as the User already exists for that database I was refused.

I can't remove the user from the database as it owns the stored procedures (if any one knows how I transfer ownership of stored procedures I would be gratefull for that too as I could remove ownership, remove the User, create the Login and add the user to the dB and then transfer ownership back).

My questions are:
How do I attatch an existing User to a new Login?
How do I transfer ownership of Stored Procedures?
Preferably using Enterprise Manager or Query Analyser.
Thanks for any help
Richard

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2005-09-10 : 10:05:53
>>How do I attatch an existing User to a new Login?

--from the database that contains the existing user:
EXEC sp_change_users_login 'Update_One', '<NewLogin>', '<ExistingUser>'


>>How do I transfer ownership of Stored Procedures?
exec sp_changeobjectowner '<object>', '<newOwner>'

You won't need to do this since sp_change_users_login should fix your problem :)

Be One with the Optimizer
TG
Go to Top of Page

Richard210363
Starting Member

2 Posts

Posted - 2005-09-11 : 14:14:24
Those worked fine.
Thanks very much.
Richard
Go to Top of Page
   

- Advertisement -