Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

BCP and Double Quotes

1,504 views
Skip to first unread message

LANDGRAF

unread,
Jul 24, 2000, 3:00:00 AM7/24/00
to
Hi,

I would like to put double quotes around my text data like you have the
option to do with DTS. Can you do this with BCP? i.e. 1234, "187 Main
St", "Boston", 567, "USA"

Thanks for any tips.
Susan


Andrew J. Kelly

unread,
Jul 24, 2000, 3:00:00 AM7/24/00
to

Susan,

Sure, take a look at BCP in BooksOnLine and take note of the FORMAT file
stuff.

Andy

"LANDGRAF" <LAND...@unhcr.ch> wrote in message
news:397C6152...@unhcr.ch...

LANDGRAF

unread,
Jul 25, 2000, 3:00:00 AM7/25/00
to
Yes, I looked at the format file information, but I couldn't find anything on
double quotes. Could you tell me which parameter to set when using the format
file? Thanks.

Susan

LANDGRAF

unread,
Jul 25, 2000, 3:00:00 AM7/25/00
to
Is this true?

I have several csv files which I need to import into tables on a
regular basis. I wish to automate this using bcp within stored
procedures. However, each field in the csv file has a text qualifier
eg "field1","field2","field3" etc
If you use the import facility in Access it can handle a text qualifier
with no problems at all, however it seems that bcp has no provision for
text qualifier's, it can only handle csv files in the format :
field1,field2,field3,field4
So if you atempt to bcp in a file with text qualifiers, the quote marks
will get imported into the fields along with the data. Is there a way
around this to get bcp to deal with text qualifiers or will I have to
remove them from the files first (not desirable).

It seems odd that Access would have more options in its import facility
than SQL Server! It is very common to get csv files with text
qualifiers.

Andrew J. Kelly

unread,
Jul 25, 2000, 3:00:00 AM7/25/00
to

Susan,

On second thought, I am not sure if I have used BCP with a file using
"'s as the char markers. Well there is always DTS. You can script DTS to do
almost anything and I know it handles a text file such as this with no
problem. I import files with "'s around char fields all the time using DTS.

Andy

"LANDGRAF" <LAND...@unhcr.ch> wrote in message

news:397D6742...@unhcr.ch...

Allan

unread,
Jul 25, 2000, 3:00:00 AM7/25/00
to
look at a format file.
You can get rid of quotes by essentially declaring them as part of the
delimiter between columns

Allan
"Andrew J. Kelly" <ake...@gtmi.net> wrote in message
news:upUDy6i9$GA.301@cppssbbsa04...

LANDGRAF

unread,
Jul 25, 2000, 3:00:00 AM7/25/00
to
Thanks for the reply. My original request was to add " 's as a part of my bcp
export. Here is my command line which is not accomplishing this:
bcp Assets out asset.txt -c -t ,"" -U"sa" -P"sa"

Thanks for the help.
Susan

LANDGRAF

unread,
Jul 25, 2000, 3:00:00 AM7/25/00
to

I see not how I can put in a quote as a column delimiter, but there isn't one
placed at the beginning or the end of the record. This throws off the balance of
quotes being around each field. Can this be accomplished? Thanks.

Susan

Andrew J. Kelly

unread,
Jul 25, 2000, 3:00:00 AM7/25/00
to
Susan,

I don't think you want the quotes as the column delimiter. I believe
your looking to denote a character column by enclosing all the characters in
that column with double quotes. That's different from a column delimiter so
this would happen. I am sorry but I don't know how to accomplish this with
BCP, just DTS.

Andy

"LANDGRAF" <LAND...@unhcr.ch> wrote in message

news:397D9079...@unhcr.ch...

LANDGRAF

unread,
Jul 26, 2000, 3:00:00 AM7/26/00
to
Yes Andrew, you're absolutely right. I'm sorry about my miswording. Thank you
for all your responses. I learned something anyway.
0 new messages