Creating a SQL insert script for your test data

By | April 9, 2009

When developing a ETL package a lot of work goes into creating test data, usually you load a file in SSIS and enrich it with data. It could be very useful when you could script this test data so you can recreate it on thy fly or share it with you colleague developers.

Using SQL Server management studio you can generate a script from the data in your tables. Go to your database, right mouse click, Tasks and click Generate scripts

Click next on the splash screen, select your database, at the script options screen set the select script data value to True, set all other properties to false.

image

Click next, On the next screens select all tables you want to select and click the desired output and click finish. It will now create your data script.