Convert data in Excel into SQL statements and convert data into SQL statements
If the excel table contains three columns of data: A, B, and C, and you want to import the data to the users table of the database, the corresponding fields are name, sex, age, add a column to your excel table and use the excel Formula to automatically generate SQL statements. The method is as follows:
1. Add a column to your excel worksheet
2. In column D of the first row, enter the formula = CONCATENATE ("insert into PERSONS_SERIAL_NUMBER (PERSONS_NO, PERSONS_NAME, ID_NUMBER) VALUES ('" & B1 &"', '"& C1 &"', '"& E1 &"');")
3. At this time, D1 has generated the following SQL statement: INSERT INTO PERSONS_SERIAL_NUMBER (PERSONS_NO, PERSONS_NAME, ID_NUMBER) VALUES ('xxxxxx', 'xxxx, 'xxxxxxxxxxxx ');
4. Copy the D1 formula to column D of all rows by placing the data in the bottom right corner of the cell. When the mouse turns into a cross shape, the data will be automatically copied when you drag it down to the last row, dynamically change the parameters in values
5. All SQL statements have been generated in column D.
6. Copy column D to a plain text file. We recommend that you use UltraEdit for processing.