Get an Excel data table, as shown in the data format:
2. Build a table structure that saves Excel data based on Excel data results
CREATE TABLE #tmpExcel (IP varchar), IPAddress varchar (StartTime), EndTime varchar (50)
, Rankfirst varchar, ranklast varchar, Calculate int,firstname varchar (10))
3. Build in Excel
Building statements that generate SQL
=concatenate ("INSERT INTO DaoRu001" (IP VARCHAR), IPAddress varchar (+), StartTime datetime,endtime datetime, Rankfirst varchar (ranklast), Calculate int,firstname varchar (TEN)) VALUES (' ", A2," ', ' ", B2," ', ' ", C2," ', ' ", D2," '); ")
4. Copy the statement to a blank column in the Excel datasheet, as shown in: 5, double-click the lower-right box of cell I2, fill data 6, update the data table format: 7, the data from I2 to I7 in Excel I is copied to the data for execution
8, the statement execution succeeds, the data inserts into the database
Excel data is imported into the database by building SQL statements