Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Bulk insert csv data having single quotes

Author  Topic 

infodemers
Posting Yak Master

183 Posts

Posted - 2011-07-12 : 14:39:43
I wish to bulk insert a CSV file using a formatfile. The data is enclosed in single quotes like the following. What should be the fieldterminator in this case?

'604','755','InService','NPIN','Not Reserved','Retail','3','BC'

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-07-12 : 14:51:44
I'd use comma as the field terminator, and then I'd remove the wrapping single quotes after the import into a staging table. But that's just me.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

infodemers
Posting Yak Master

183 Posts

Posted - 2011-07-12 : 15:21:11
Hi tkizer,

I did what you suggested and it works fine.

Thanks for the trick!
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-07-12 : 15:42:52
You're welcome, glad to help.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -