SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 default database in transfer login script
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

vanbasten
Starting Member

Netherlands
7 Posts

Posted - 04/04/2011 :  16:20:23  Show Profile  Reply with Quote
I need to make a copy of db from sql server 2000 to sql server 2000. I am following this instruction (Method 1) to create sp_help_revlogin procedure to transfer logins.

http://support.microsoft.com/kb/246133

However, the script generated does not have the command to set default database for logins. Am I missing something or am I supposed to set the default database manually for each logins even I am using the script?

Thanks.

llinares
Starting Member

3 Posts

Posted - 04/05/2011 :  10:22:30  Show Profile  Reply with Quote
You need to add code to make it do that.
DECLARE @defaultdb sysname


BEGIN
IF (@@fetch_status <> -2)
BEGIN
PRINT ''
SET @tmpstr = '-- Login: ' + @name
-- ADD THIS LINE:
SELECT @defaultdb = dbname from master..syslogins where [name] = @name
PRINT @tmpstr
IF (@xstatus & 4) = 4
BEGIN -- NT authenticated account/group


Then when you set @tmpstr modify it to something like this:

SET @tmpstr = @tmpstr + @CR + 'EXEC master..sp_addlogin ''' + @name + ''', NULL, @defdb = ' + @defaultdb + ', @sid = ' + @SID_string + ', @encryptopt = '



Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000