I have table with 17 columns and I have to insert rows from a particular file into this table.
Number of rows in that file are ~ 4000.
I have approached ExecuteMany(qry)
method to insert multiple rows, but I have final columns data as:
rows = [('abc','x',....),(....),..] # 4k tuples in this list
Now I have problem in passing this tuples at a time in the final query
Can anybody help me in passing this values to the this final query?
sql = "INSERT INTO [dbo].["+tablename+"] VALUES {}".format(rows)
cursor.executemany(sql)
Update: SQL Server 2008 throws error for insertion of more than 1k rows at a time
So how to resolve this issue with any other way?