Creating default data in Visual Studio / SQL Server database projects

Is there a way to use data creation plans in VS 2010 database projects to create a default dataset? Or am I barking the wrong tree, that is, data creation plans that are most suitable for creating dummy example data?

We have a bunch of data (default settings, default users, etc.) that needs to be created for each database deployment. It would be nice to have the tools to help us with this, so it can be controlled from the source and better managed.

I guess there are probably third-party alternatives, but I hope there is a built-in Visual-Studio way to do something so that it can integrate perfectly with TFS, etc.

+4
source share
1 answer

There are probably different ways to do this, but the basics:

  • create a script that inserts your default data
  • Modify Script.PostDeployment.sql script to use script to insert default values

For example, I created a new DefaultData folder in the Scripts-> Post-Deployment folder of my project and added my script to insert the default data here, InsertDefaultData.sql. Then I added the following line to Script.PostDeployment.sql ": r .. \ DefaultData \ InsertDefaultData.sql".

+5
source

All Articles