Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select existing data from database to create test data

I have a SqlServer database that I've manually filled with some test data. Now I'd like to extract this test data as insert statements and check it in to source control. The idea is that other team members should be able to create the same database, run the created insert scripts and have the same data to test and develop on.

Is there a good tool out there to do this? I'm not looking for a tool to generate data as discussed here.

like image 505
Riri Avatar asked Sep 14 '26 06:09

Riri


2 Answers

If you want a light-weight solution, I would recommend sp_generate_inserts. It is a store procedure you can create on your DB and pass in a variety of arguments to generate insert statements of all the data in the target table.

like image 197
Steven Williams Avatar answered Sep 16 '26 21:09

Steven Williams


EMS DB Extract for SQL Server (http://www.sqlmanager.net/en/products/mssql/extract) seems to do what you want, and it seems to be free.

Hope this helps,

Robin

like image 39
robintw Avatar answered Sep 16 '26 20:09

robintw



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!