How can we help you today? How can we help you today?

Formatting code with BulkInsert and CODEPAGE

Hi,
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>&nbsp;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
JR_GER
0

Comments

3 comments

  • Sujay
    Hi Joachim,

    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
    Sujay
    0
  • Sujay
    Hi 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
    0
  • JR_GER
    Hi,

    Works like a charm. Very simple solution.
    I should have tested this approach before asking.  %‑)

    Thanks a lot.

    JR
    JR_GER
    0

Add comment

Please sign in to leave a comment.