Converting a DataTable to an CREATE TABLE + INSERT script for SQL in C#

后端 未结 4 490
暗喜
暗喜 2020-12-09 06:37

I need to generate a TSQL script from a DataTable along with the DATA in it. It\'s not a single insert. Beside that, I need the create the table too (same datatable structur

4条回答
  •  春和景丽
    2020-12-09 07:25

    Please use the tool created by me if you want to create the insert script from the table. This creates Insert script on multiple table based on condition given:

    IF NOT EXISTS (Select 1 from Table1 WHERE Col1='Col1' AND Col2='Col2')
    INSERT INTO Table1 (Col1,Col2,Col3,Col4) VALUES (1,'abc',null,'2012-01-01')
    

    Here is the link: http://www.codeproject.com/Tips/330864/Generate-Insert-script-to-extract-data

提交回复
热议问题