0

I'm looking for good ideas how to copy the whole Schema from a SqlAzure Database to another SQL Azure Database. (Tables, Data)

Goal:

I'd like to use a "template" Database seperated with Schemas. Each schema represent another kind of "template" data. On creating a new database (ef6, c#) I want to add the selected Template-Data...

What I tried:

=> Creating bacpac and try to import this.

Works great, but you can only import to new database, not to an existing database.

=> Creating scripts

Works but painfull.

Anyone can give me an advise ?

Cyril Iselin
  • 596
  • 4
  • 20
  • You want to start using SSDT. Once you have your schemas set up (for your scenario you may want one project per schema, since it sounds like you're treating schemas like separate databases). Once you have your projects set up, you can add post deployment scripts that will be applied after the schema is applied. From there, you can create alter scripts, or dacpacs with post deployment steps. See my post here: http://stackoverflow.com/questions/39209534/using-select-into-with-azure-sql-to-copy-data-from-another-db/39274065#39274065 – Shannon Lowder Sep 01 '16 at 23:28

1 Answers1

1

Have you tried using the schema compare feature in the SQL Server Data Tools available for Visual Studio? It will allow you to compare the complete schema of your template database and your target database. Once it has done the diff, you should use Group By > Schema to organize the results which will then enable you to selectively apply the changes for one or more specific Schema(s) to the target database. For more info on SQL Server Data Tools see https://msdn.microsoft.com/en-us/mt186501