SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Bulk Insert and FieldTerminator Problem
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

bholmstrom
Yak Posting Veteran

USA
71 Posts

Posted - 05/02/2013 :  14:13:21  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

Pakistan
1052 Posts

Posted - 05/02/2013 :  14:45:43  Show Profile  Reply with Quote
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

Edited by - MIK_2008 on 05/02/2013 14:46:48
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000