A large number of test data needs to be inserted into the SQLite database, and the intention is to loop the insert operation with a transaction, although SQLite does not support declare variable definitions and cannot be implemented by defining the loop variable value.
You need to iterate through a batch file to insert the SQLite statement in the following way
Create a circular call to the batch file Sqlite.bat, the contents of the file
Copy Code code as follows:
@ECHO off
FOR/L%%i in (1,1,10000) do (Sqlite3.exe Test.db<insertdb.bat)
Pause
This file indicates that the loop 10000 call Insertdb.bat operates on the TEST.DB database. Write the SQLite statement in the Insertdb.bat file.
Copy Code code as follows:
INSERT into Test (COL1,COL2,COL3,COL4,COL5,COL6,COL7,)
Values
(' col1 ', ' col2 ', ' col3 ', ' col4 ', ' col5 ', 6,7);
NOTE: The SQL statement in the Insertdb.bat file must end with a semicolon, or it will cause an error in the execution of SQLite. sqlite.bat,insertdb.bat,test.db files need to be placed in the same directory