Default database for logins

  • I move sql server 2005 to another new server. I know there is a way to generate login scripts and run it to on new servers to recreate the logins.

    But I also read the script will not include the default databases to those logins.

    So is there a way or sql to generate the default db of the logins on the old server, so that I can do either manually or script to set the default db on the new server?

    Thanks

  • The sp_help_revlogin script for SQL2005 does include the default database for the logins.

    but anyway this would script them out for you as well (SQL2000 syntax but will work)

    set quoted_identifier off

    select 'exec sp_defaultdb ',+"'" +loginname +"'," +dbname from syslogins

    ---------------------------------------------------------------------

  • Thanks, what does set quoted_identifier off mean?

    Is this just a setting for the sql statement or is it turn off for all future sql statements.

    Do I need to turn it back on?

    Thanks

  • 'SET QUOTED_IDENTIFIER OFF' means identifiers can not be designated with double-quotes and must follow all appropriate identifier rules. You'll see this statement most of the time when an INSERT/UPDATE is run on a text-type column and the field has the potential to contain a single-quote (a contraction for instance).

    Hope this helps...Troy

  • and it is just in the context of that query window. so no it is not server wide and you don't need to turn it on again

    ---------------------------------------------------------------------

  • Thank you!

  • Thanks, George.

    That's good to know.

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply