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