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

No comments:

Post a Comment