2012年3月22日星期四

bcp Question

Without using format file, is there a way for bcp to ignore single quote in
an import file? Thanks.Why are you not wanting to use a format file?
mason wrote:
> Without using format file, is there a way for bcp to ignore single quote i
n
> an import file? Thanks.
>|||Try -q option. More information in BOL.|||I have no problem using format files, but it would be simpler to do without
in terms of maintenance. -c option works well when there is no quote in
import files (about 36 of them). I just want to verify whether there is an
option somewhere to ignore quotes for bcp.
"Carl Imthurn" <nospam@.all.com> wrote in message
news:OvDmLQsQGHA.5768@.tk2msftngp13.phx.gbl...
> Why are you not wanting to use a format file?
> mason wrote:|||Just tried. It's not what I wanted. I think -q affects identifiers, not the
data elements in a data file.
For example, a data record looks like this. I would like bcp to ignore
single quotes when importing.
1,'John','2006-03-08 12:00:00.000'
"Green" <subhash.daga@.gmail.com> wrote in message
news:1141831907.411815.10740@.p10g2000cwp.googlegroups.com...
> Try -q option. More information in BOL.|||Would it be possible to create the data file without the apostrophes?
Looking at your example, it seems that you have a comma-delimited file
with apostrophes delimiting text fields but not numeric fields.
I needed to deal with that situation once - I was faced with quotes
rather than apostrophes, but the concept was the same. The only thing I
was able to figure out was to import the text file to a SQL Server table
via DTS because of the fact that some fields have a delimiting
character, some do not.
Good luck - hope this was helpful.
Carl
mason wrote:

> Just tried. It's not what I wanted. I think -q affects identifiers, not
> the data elements in a data file.
> For example, a data record looks like this. I would like bcp to ignore
> single quotes when importing.
> 1,'John','2006-03-08 12:00:00.000'
>
>
> "Green" <subhash.daga@.gmail.com> wrote in message
> news:1141831907.411815.10740@.p10g2000cwp.googlegroups.com...
>
>|||Of course. I will most likely do that at the export end. Since the files may
also feed Sybase and Oracle, it gets ugly. Thanks.
"Carl Imthurn" <nospam@.all.com> wrote in message
news:eJ2605sQGHA.5808@.TK2MSFTNGP12.phx.gbl...
> Would it be possible to create the data file without the apostrophes?
> Looking at your example, it seems that you have a comma-delimited file
> with apostrophes delimiting text fields but not numeric fields.
> I needed to deal with that situation once - I was faced with quotes rather
> than apostrophes, but the concept was the same. The only thing I was able
> to figure out was to import the text file to a SQL Server table via DTS
> because of the fact that some fields have a delimiting character, some do
> not.
> Good luck - hope this was helpful.
> Carl
> mason wrote:
>
>

没有评论:

发表评论