• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 354
  • Last Modified:

SQL Server bulk insert of .csv file fieldterminator

I am trying to utilize bulk insert in SQL Server 2008. The data is in a .csv format. The code I've run is below:
BULK INSERT Alerts FROM 'C:\Alerts.csv'
   WITH (
      DATAFILETYPE = 'char',
      FIELDTERMINATOR = ',',
      ROWTERMINATOR = '\n'
)
The insert works, but the fields have the wrong data in several records. The problem is that a few of the fields in the .csv file have commas in the text. What would be the best fieldterminator to use in a case like this?
0
dodgerfan
Asked:
dodgerfan
1 Solution
 
Shaun KlineLead Software EngineerCommented:
If you have the ability to change the delimiter in the .csv file, use either tab delimited or pipe delimited (|).
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now