Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unable to add user to restored database

Status
Not open for further replies.

cceng

IS-IT--Management
Aug 27, 2001
104
US
I had to restore a production db to a test db on the same server. When I try and give a sql user rights to the DB it keeps asking for the password. I know I am entering the correct password but it keeps saying it is wrong.

How do I correct this issue? I am guessing it from restoring the database and the user having rights to that DB in the production.

I am a newbie and only slightly dangerous with sql command. Any help is appreciated.

thanks!

Chris
 
Just a quick thought, are you sure YOU have the necessary permissions to GRANT access to the DB?


Cheers,
Leigh

"Give a man a fish and he can feed himself for a day..."
Give him the means to catch his own fish and he can really annoy his girlfriend by spending all his spare time fishing!


Join the PAC -
 
Execute the below script on your dev db. It should map users that are out of syn.

[tt]
--use the following script to quickly map users to logins
declare @usrname varchar(100), @command varchar(100)

declare Crs insensitive cursor for
select name as UserName from sysusers
where issqluser = 1
and (sid is not null and sid <> 0x0)
and suser_sname(sid) is null
order by name
for read only

open Crs
fetch next from Crs into @usrname

while @@fetch_status=0
begin
select @command=' sp_change_users_login ''update_one'', '''+@usrname+''', '''+@usrname+''' '
exec(@command)
fetch next from Crs into @usrname
end
close Crs
deallocate Crs
[/tt]



Dr.Sql
Good Luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top