Create INSERT statement with data from existing table
Posted on 2006-06-22
Does anyone have a T-SQL script that creates insert statements from an existing table, using the current table's data?
For example, let's say we have a table called [mytable] and the table contains two columns [a] and [b], with the following data:
I would like a script that would create the following insert statements:
insert into [mytable] ([a], [b]) values ('a1','b1');
insert into [mytable] ([a], [b]) values ('a2','b2');
I have about 10 tables against which I would need to run this, all with varying numbers of rows and columns, so I'm hoping for something generic.
Thanks in advance!!! :-)