Friday, January 18, 2008

Generate INSERT statements from SQL Server table data

It is often necessary to copy data between two tables (for example between staging and production databases). SQL Server makes this task rather complicated (you have to resort to export/import). In MySQL it is possible to generate INSERT statements for all the records in a table, and some SQL Server client tools (such as the somewhat immature but excellent Toad) also do this.

The really low cost solution though is to use this stored procedure:
http://vyaskn.tripod.com/code.htm#inserts

1 Comments:

Anonymous moz said...

That works, thanks so much. I've been manually scripting these because we have enough tables that the MS import/export wizard struggles with that it's easier just to ... run your script, now.

8:35 PM  

Post a Comment

Subscribe to Post Comments [Atom]

<< Home