user2323240 user2323240 - 1 year ago 93
SQL Question

Generate sql insert script from excel worksheet

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?

Answer Source

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:


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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download