Excel data into SQL script

Source: Internet
Author: User

In real-world project development, there are times when customers let us import large amounts of Excel data into a database. We can then bulk import the database by converting Excel data into SQL scripts.

1 insert a column of cells before the data to spell the SQL statement.

Specific wording: = "INSERT into T_student (id,name,age,class) value (" &B2& ", '" &C2& "'," &D2& ", '" &e2 & "');

"&B2&" stands for B2 cell data, if the cell data is required for a string ' package '.

2 When SQL is written, move the mouse to the end of SQL to enter directly.

3 Mouse to the first line of the formula, the left mouse button down drag down to the last line of data row, and then release the key, so that all the formula is finished.

Note: add ";" to the end of SQL, and there may be special characters such as ',& ' in the data that can be replaced globally after the SQL statement is generated.

Finally, copy SQL to the SQL file and execute the SQL script in the database.

Take Plsql as an example, create a new command window and enter the following commands.

Excel data into SQL script

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.