I’ve spent a couple days scratching my head trying to figure how to execute a SQL bulk insert command to get csv file data into a table. I was able to do the bulk insert from ssms but not from ignition. I finally figured out the problem this morning and thought I’d share.
When I ran the script
import system bulkinsert = "BULK INSERT UsersTemp FROM 'C:\bulk\test.csv' WITH (fieldterminator=',',firstrow=2)" system.db.runUpdateQuery(bulkinsert,"MFGdbConnection")
I would get an error that including the line below:
Error executing system.db.runUpdateQuery(BULK INSERT UsersTemp FROM ‘C:ulk est.csv’
I noticed the error was formatted odd. The ‘/b’ from the folder name ‘/bulk’ and the ‘/t’ from the file name ‘/test’ were changed to ‘’ and ’ '.
The resolution was to change the folder and file name to avoid the formatting issue and suddenly it works. My new file location is C:\sulk\sest.csv
Ignition Platform 8.0.0 (b2019040718)