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.
Author |
Topic |
TRACEYSQL
Aged Yak Warrior
594 Posts |
Posted - 2007-01-11 : 10:18:24
|
If i restore a database from Live To Test.LIVE SERVER Add tracey DB USER traceyNow i restore this on TEST SERVER Tracey is missing.So i usually run thisdeclare @usrname varchar(100), @command varchar(100)declare Crs insensitive cursor forselect name as UserName from sysuserswhere issqluser = 1 and (sid is not null and sid <> 0x0)and suser_sname(sid) is nullorder by namefor read onlyopen Crsfetch next from Crs into @usrnamewhile @@fetch_status=0beginselect @command=' sp_change_users_login ''auto_fix'', '''+@usrname+''' 'exec(@command)fetch next from Crs into @usrnameendclose Crsdeallocate CrsBut if the user is not in security login then its not working.Is there a script that can do this....Thanks |
|
|
|
|