Run on source, execute output on destination:--http://sqlmag.com/query-analyser/sql-server-login-transfer--SQLSET NOCOUNT ONSELECT 'EXEC sp_addlogin @loginame = ''' + loginname + '''',', @defdb = ''' + dbname + '''',', @deflanguage = ''' + language + '''',', @encryptopt = ''skip_encryption''',', @passwd =', cast(password AS varbinary(256)),', @sid =', sidFROM sysloginsWHERE name NOT IN ('sa')AND isntname = 0--WindowsSELECT 'EXEC sp_grantlogin @loginame = ''' + loginname + '''',' EXEC sp_defaultdb @loginame = ''' + loginname + '''',', @defdb = ''' + dbname + ''''FROM sysloginsWHERE loginname NOT IN ('BUILTIN\Administrators')AND isntname = 1
Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/