1

What I am doing is creating a DBProject.. importing a DB.. then creating scripts in the PostBuild that are DATA scripts for each table (so that the post build can populate the tables after the schema is generated..

Then problem is some of these tables containg 50,000 rows and when you put a 50,000 row insert into ONE .sql file for the post build it fails because it is too big.. so.

  1. Is there a better way to achieve this ? (getting a schema and data of a DB created as part of a DBprojects Build/Publish)

  2. If this way is valid.. Is the only thing to do is create another post build process that manually breaks the one big .sql file into smaller .sql files ? (so it can build/publish)

  • What is this data for? Are you setting up a dev/test database? If so, I don' think you want to do this for every build, that is more of a one time environment setup process. – cdkMoose May 8 '13 at 16:42
  • This is data for creating a temp DB used for Integration testing.. running CRUD commands and assertions on the DB.. then shutting it down.. eventually it would be nice to have this as part of tests run in TFS for every build yes – punkouter May 8 '13 at 16:52
  • Then I would leave this as part of your test environment setup/reset process and not part of the build process. – cdkMoose May 8 '13 at 17:02
2

We had a similar situation (actually we were using Entity Framework to create and populate the database) where we were populating a table of address data. Basically, we exported the address data into a csv file and used the SQL Bulk Insert command to process it (which took seconds instead of minutes to do). Possibly doing the same within the post build of your DBProj would fix your problem.

  • +1. Backup/restore may be used in the same way, IMO (and would be probably much faster). – Arseni Mourzenko May 8 '13 at 18:05
  • so perhaps using the post build event command line is the right way to do this instead of running a bunch of .sql files in a DBproject ? .. You used SQL Bulk or the Entity API to do all the inserts ? – punkouter May 9 '13 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.