generate script a database and load another one

  • Hi. i want to generate scripts of a database and then i load this script to another db. i do generate scripts. ow can i load this another db.

    Thanks.

  • At the beginning of the script, put

    USE [OtherDatabase];

    This will change the scope of the script to the other database. Make sure the script doesn't contain other USE statements that change the scope back.

    This will only work when the two databases are on the same server.

    Alternatively, you could just select the other database in the dropdown at the SSMS toolbar.

    If the other database is at another server, you need to change the connection.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

Viewing 2 posts - 1 through 1 (of 1 total)

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