August 6, 2008 at 2:37 am
Hi...
I need a script which can generate insert statements for all the records in a table.
for eg: if a table abc has 2 records, then on executing this script, it should generate 2 insert statements with column names and values.
thx
raj
August 6, 2008 at 2:42 am
There may be the possibilities that table either contains Primary / Identity Field or may not contains any ke, so in that case how do you insert the record ?
Abhijit - http://abhijitmore.wordpress.com
August 6, 2008 at 2:54 am
That doesnot matter... Ultimately , i need insert statement for each record in the table.
August 6, 2008 at 8:23 am
I'm lazy, I use ApexSQL Edit.... =)
August 6, 2008 at 8:34 am
toprprasad (8/6/2008)
Hi...I need a script which can generate insert statements for all the records in a table.
for eg: if a table abc has 2 records, then on executing this script, it should generate 2 insert statements with column names and values.
thx
raj
See the method in the link in my signature below.
--Jeff Moden
Change is inevitable... Change for the better is not.
May 14, 2010 at 2:41 am
In case you miss is, article Generating Insert Statements[/url] is republished today.
Also, there is my own article, Scripting INSERTs[/url], which is intended to do address a slight different issue - where you want to script individual bits of tables, perhaps subject to conditions on the records - and also you can edit the script more easily if you aren't just looking for a straight copy. It doesn't support some of the more exotic datatypes though.
I think both are subject to the provisos about IDENTITY fields etc, although I guess if you can just turn IDENTITY_INSERT on for the table in that particular case.
Tony
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply