Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (20.3k points)

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?

1 Answer

0 votes
by (40.7k points)

You can use Excel to create insert statements like this, As import using one of the methods mentioned is ideal for a large file.

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

In MS SQL you can try using this:

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.

if you want to Learn about Sql commands visit  SQL Command Cheat Sheet.

You can learn in-depth about SQL statements, queries and become proficient in SQL queries by enrolling in our industry-recognized SQL course.

Browse Categories

...