Question

I am working on Visual Studio Database Project,i have imported existing Database Schema from Database Server, made my database project as sand box so that whoever ever changes it,it should be done locally before committing to Database Server .

Next i have created data using Data Generation Plans(Using Sequential Databound Generator) , since our project need to have data for some of tables ( Master and Initialize).

I am able to achieve this as well, now in order to deploy the database into another system or P.C., i have to change connection string of Deploy tab under project Properties.

After successful deployment i came to know that only database got created, but database generation has not ran, i figured out it's because of the connection string i had provided for each tables in Data Generation Plans(because of Sequential Datbound Generator).

Now is there any way to change the connection string in one common place for Sequential Databound Generator, because i have nearly 42 tables and for each column i need to change the connection string in order to insert the data.

Thanks in advance

Was it helpful?

Solution

though i am new to this DB proj in TFS, in order to insert data during deployment you need to add some script in Script.PostDeployment.sql under scripts folder, in our case we have more than 42 tables to insert data, instead of mentioning all INSERT scripts i have used SQLCMD commands there you need to mention the .SQL file which has INSERT queries for various tables, for example

:SETVAR tablevar TempMasterDataFile

:r "D:\SandBox\CreateNewDB\MasterData.sql"

GO  

during deployment the above query will be appended along with SQLCMD utility.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top