Formatting code with BulkInsert and CODEPAGE
JR_GER
Posts: 4 New member
Hi,
In a stored procedure, I'm using "BULK INSERT" to import a CSV which is UTF-8 encoded.
But SQL Prompt is throwing an error if I want to format the code:
If I comment out this line, formatting works well.
Where's the problem here?
TIA
JR
In a stored procedure, I'm using "BULK INSERT" to import a CSV which is UTF-8 encoded.
So the code looks like:
--->8 SNIP ---
BULK INSERT tbl_XYZ<br>FROM 'D:\Imports\txt.csv'<br>WITH<br>(<br> CODEPAGE = '65001'<br>,FIELDTERMINATOR = '@@@'<br>,ROWTERMINATOR = '\n'<br><div>)</div>--- SNAP 8< ---
But SQL Prompt is throwing an error if I want to format the code:
If I comment out this line, formatting works well.
Where's the problem here?
TIA
JR
Tagged:
Best Answer
-
Sujay Posts: 54 Bronze 3Hi Joachim,
Unfortunately, it is the Microsoft Parser which we use for formatting causing the parsing error.
The error occurs due to the value of CODEPAGE being supplied in quotes
However, if the script is modified as below, the parsing errors are not observed.
Could you check if this works for you?
Regards,
Sujay Diwan
Sujay Diwan| Product Support Engineer | Redgate Software
Answers
Thank you for your forum post. The issue has been escalated to the development team. I will post here as soon as there is an update available.
Regards,
Sujay Diwan
Works like a charm. Very simple solution.
I should have tested this approach before asking.
Thanks a lot.
JR