bulk insert sql server code example
Example 1: Simple Bulk insert TSQL csv
BULK
INSERT
[SALES].[Flowers]
FROM 'C:\x\Learning\SQLServer2008DatabaseDev\FlowersData.csv'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
GO
Example 2: insert bulk values into table in sqlite
# connect to db
database = sqlite3.connect('database.db')
cursor = database.cursor()
# using INSERT INTO in bulk (where each line represents a new entry)
cursor.execute('''INSERT INTO tablename (column1,column2) VALUES
(data1,data2),
(data3,data4),
(data5,data6),
(data7,data8)''')
# disconnect from db :)
database.commit()
cursor.close()