Showing posts with label surrounded. Show all posts
Showing posts with label surrounded. Show all posts

Wednesday, March 7, 2012

BULK INSERT and text fields

Hi,

I am trying to do a bulk insert using a text file that is comma delimited.

In the text file there are fields which are surrounded by quotes and contain commas; these commans should not be considered delimiters.

Is there a way to tell the BULK INSERT statement not to treat these as delimiters?

thanks,

sivilianyou need to set the field qualifiers.|||Do you mean using format files in order to do this?

If so I do not believe that you can do it even with that.

I found this excerpt from SQL Books Online.

Important Terminators must be chosen to ensure that their pattern does not appear in any of the data. For example, when using tab terminators with a field that contains tabs as part of the data, bcp does not know which tab represents the end of the field. The bcp utility always looks for the first possible character(s) that matches the terminator it expects. Using a character sequence with characters that do not occur in the data avoids this conflict.

If I am wrong and I hope I am; Can you elaborate as to how to set these field qualifers.

thanks,

sivilian

Friday, February 24, 2012

BULK INSERT

Hi,
I am trying to do a bulk insert using a text file that is comma delimited.
In the text file there are fields which are surrounded by quotes and contain commas; these commans should not be considered delimiters.
Is there a way to tell the BULK INSERT statement not to treat these as delimiters?
thanks,
JohTo do this you will have to use a format file
For an example see
http://www.nigelrivett.net/BCP_quoted_CSV_Format_file.html
Nigel Rivett
www.nigelrivett.net
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

BULK INSERT

Hi,
I am trying to do a bulk insert using a text file that is comma delimited.
In the text file there are fields which are surrounded by quotes and contain commas; these commans should not be considered delimiters.
Is there a way to tell the BULK INSERT statement not to treat these as delimiters?
thanks,
John
To do this you will have to use a format file
For an example see
http://www.nigelrivett.net/BCP_quote...rmat_file.html
Nigel Rivett
www.nigelrivett.net
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!