Matching Logins

Last Post 18 Oct 2006 09:12 PM by myLittleTools. 1 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
Iain_C
New Member
New Member

--
02 Aug 2006 04:25 AM
Hello,
I use the script below in SQL 2000. When I restore a database to a new server the local groups have the same name and different sids, so the script matchs the sid. But this is allowed in 2005, any ideas

USE master
GO
sp_configure 'allow updates', '1'
GO
RECONFIGURE WITH OVERRIDE
GO

update MyDB..sysusers
set sid = sl.sid
from MyDB..sysusers su join master.sys.syslogins sl on (('ServerName\' + su.name) = sl.name) where su.sid <> sl.sid

EXEC master..sp_configure 'allow updates', '0'
RECONFIGURE WITH OVERRIDE
myLittleTools
New Member
New Member

--
18 Oct 2006 09:12 PM
You can use sp_change_users_login to make user mapping.

Hope this helps

_______________________________
myLittleAdmin for SQL Server 2005
The First Web-Based Management Tool
Specially Designed For SQL Server 2005



Acceptable Use Policy
---