Generate sql insert script from excel worksheet

后端 未结 13 1014
情深已故
情深已故 2020-11-28 18:05

I have a large excel worksheet that I want to add to my database.

Can I generate an SQL insert script from this excel worksheet?

13条回答
  •  北海茫月
    2020-11-28 18:33

    I think importing using one of the methods mentioned is ideal if it truly is a large file, but you can use Excel to create insert statements:

    ="INSERT INTO table_name VALUES('"&A1&"','"&B1&"','"&C1&"')"
    

    In MS SQL you can use:

    SET NOCOUNT ON
    

    To forego showing all the '1 row affected' comments. And if you are doing a lot of rows and it errors out, put a GO between statements every once in a while

提交回复
热议问题