# File/Folder name causes SQL Bulk Insert command to fail

**URL:** <https://forum.inductiveautomation.com/t/file-folder-name-causes-sql-bulk-insert-command-to-fail/24389>\
**Category:** Ignition Early Access\
**Created:** [April 25, 2019, 1:51pm UTC](https://forum.inductiveautomation.com/t/file-folder-name-causes-sql-bulk-insert-command-to-fail/24389 "2019-04-25T13:51:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dkylep](https://avatars.discourse-cdn.com/v4/letter/d/6de8d8/32.png) [@dkylep](https://forum.inductiveautomation.com/u/dkylep)\
**Post date:** [April 25, 2019, 1:51pm UTC](https://forum.inductiveautomation.com/t/file-folder-name-causes-sql-bulk-insert-command-to-fail/24389/1 "2019-04-25T13:51:48Z")

</div>

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

```auto
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)

---

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [April 25, 2019, 2:01pm UTC](https://forum.inductiveautomation.com/t/file-folder-name-causes-sql-bulk-insert-command-to-fail/24389/2 "2019-04-25T14:01:32Z")

</div>

That is not a bug. \ is an escape character. For example:

> print "Hello\nWorld" will print on 2 lines.

> You need to use "C:\\bulk\\test.csv"

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [April 25, 2019, 2:29pm UTC](https://forum.inductiveautomation.com/t/file-folder-name-causes-sql-bulk-insert-command-to-fail/24389/3 "2019-04-25T14:29:26Z")

</div>

Another option is to mark the string as ‘raw’ by prefixing the string with a single letter `r`, which means Python will not process escape characters:

```auto
initial = 'C:\bulk\test.csv'
escaped = 'C:\\bulk\\test.csv'
raw = r'C:\bulk\test.csv'

print initial, repr(initial)
print escaped, repr(escaped)
print raw, repr(raw)

```

outputs:

```auto
>>>
C:ulk	est.csv 'C:\x08ulk\test.csv'
C:\bulk\test.csv 'C:\\bulk\\test.csv'
C:\bulk\test.csv 'C:\\bulk\\test.csv'

```

---

<div class="post-metadata">

**Author:** ![dkylep](https://avatars.discourse-cdn.com/v4/letter/d/6de8d8/32.png) [@dkylep](https://forum.inductiveautomation.com/u/dkylep)\
**Post date:** [April 25, 2019, 2:51pm UTC](https://forum.inductiveautomation.com/t/file-folder-name-causes-sql-bulk-insert-command-to-fail/24389/4 "2019-04-25T14:51:49Z")

</div>

Thank you! I wish I knew this 2 days ago 😏
