Since I work as a consultant I always bring with me my “toolbox”. My latest addition to this toolbox is a SQL Server script created by Narayana Vyas Kondreddi
He has created a script that let you export your data, by generating a insert script, from a given table in a very easy way.
All you need to do to make is work is:
- Download the script and add the procedure called sp_generate_inserts
- Generate your insert script by calling: EXEC sp_generate_inserts ‘myTable’
The insert script will now be written to the output in query analyzer.
Please note that by default the query analyzer will only display the first 256 charachters from each line.
You can change this setting from: Tools->Options->Query Result->SQL Server->Result to Text.
Maximum allowed value is 8192.
You can download the script here: http://vyaskn.tripod.com/code/generate_inserts_2005.txt.
For more information on how to use the script and all the features check out this page: http://vyaskn.tripod.com/code.htm#inserts