Re: Bcp problem (2005), previously posted to microsoft.public.sqlserver.programming




"Erland Sommarskog" <esquel@xxxxxxxxxxxxx> wrote in message
news:Xns99CD25A0E078Yazorman@xxxxxxxxxxxx
Mike C# (xyz@xxxxxxx) writes:
Bcp and BULK INSERT break when I try to use the format file with the new
IDENTITY column. I've gotten around this problem before, but I'll be
darned if I can remember how. It's probably really simple, but I'm a
little out of it this morning. If anyone has any hints, it's
appreciated.

If the IDENTITY column is the first in the table, you need to change
COLUMN
SOURCE="1" to COLUMN SOURCE="2" etc. I never use the XML format file, but
in
the old-style format file the colunm with the column names is
informational
only. It's the column number that matters.

I did go back and generate the old-style format files, which worked. I'll
test the XML format file tomorrow with the SOURCE attributes bumped up by 1
each to see if that resolves it. For some reason I was thinking the XML
format file would use the column names instead of ordinal position, but it
makes sense that they wouldn't since the old BCP format didn't either.
Thanks Erland.


.



Relevant Pages


Loading