Python Code for Bulk Insert into SQL Server 2014 DateTime format -


this script run in python. getting bulk load conversion error (type mismatch or invalid character specified codepage) error.. datetime field.

qry = "bulk insert tbl 'c:\users\...\tbl.csv' (fieldterminator = ',', firstrow = 2)" cursor.execute(qry) 

my data is

time stamp,c1,c2,c3,c4

"7/16/2015 0:05",0,0,0,3.84 ...

how set set dateformat ####; code in python before executing bulk insert? also, additional question. how sql server ignore double quotes around datatime?

try following statement (you can put on single line):

set dateformat mdy; bulk insert tbl 'c:\users\...\tbl.csv' (fieldterminator = ',', firstrow = 2); 

mind closing semicolon: tells sql first command ends , next 1 begins.


Comments