Search code examples
sql-servert-sqlsql-server-2008-r2database-migration

SQL Migration of Databases


I'm running SQL Server 2008 R2, I have a test database that I've modified to have new foreign keys and columns etc.

I was wondering what is the best way to map all of the changes to my live db?

Do I have to run a drop and create script individually on each table?

I tried to right click -> tasks -> generate database scripts -> but this gets a lot of errors when I run this.


Solution

  • The best way to compare databases and apply changes from one to the other (in your case test to production) is to use SSDT (SQL Server Data Tools).

    With this tool you can easyly compare tow databases, source and target, see the necessary scripts to update each object of the target database, so that it's exactly like the source database, and run all, or only the selected scripts to the target database.

    You can also generate an update script, or a dac pac.

    Please, see this for more information: