I have a build-definition in TFS that builds a database-project in Visual Studio. The output is a dbschema and some other files. With that dbschema I deploy that Database to another server by using vsdbcmd. This works fine to deploy the Database structure/schema.

Is it possible to also deploy the data/content of the original database to the other database? Or also put the db-content in the output from the build-definition?

Thanks

有帮助吗?

解决方案

You can include INSERT statements in the PostDeploy sql script within the DB Project to generate any data you need.

If you want to generate these INSERT statements en-masse you can use the Data Compare tool to compare a DB with data to one without, and it will gen all the INSERT statements you need that you can then copy-paste into the PostDeployment script.

其他提示

We use SQL Merge-scripts (scriptfiles with MERGE-stmts) in our post deployment scripts to keep lookup tables in the database(s) up-to-date. Create a script file for each lookup table (merge stmt) and reference these files from your post deployment script. Sometimes it can be necessary to drop FK relationships before loading data into lookup tables and to load them in a certain order. We've created two scripts, one that run before merge scripts, drops FKs, the and a second that run after merge scripts, recreates FKs. Works fine for us.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top