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
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Bulk Insert and FieldTerminator Problem

Author  Topic 

bholmstrom
Yak Posting Veteran

76 Posts

Posted - 2013-05-02 : 14:13:21
Good afternoon,

I am using a bulk insert to bring the contenets of a csv file into a temp table. The insert works but I found a new problem, some of the fields have a ',' in the middle of the field.

My field terminator is ','

Example
"Joseph Abcde","Partner","Joseph.Abcde@xxxx.com","PasswordNotRequired, NormalAccount"

"Joseph W. Wecfder, Jr.","Partner","Joseph.Wecfder@xxxx.com","NormalAccount"

Notice the comma right after the last name and before the suffix on the 2nd record.

Anything I can do about that?

Bryan Holmstrom

MIK_2008
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2013-05-02 : 14:45:43
I am not sure about the rule of terminator as if it should always be a single character or can be multiple. In case if terminator allows multiple characters and if every value in the file is enclosed with double qoutes "? then try terminator as to be --> ","

Else, I would suggest to regenerate the file (if possible) with a differnt terminator with a unique character (terminator) e.g. pipe |

Or, open the CSV with Excel file and save it as Excel format and then read that excel using openrowset etc queries

Or ....

Cheers
MIK
Go to Top of Page
   

- Advertisement -