Sunday, February 19, 2012

bulk copy with an identity column

Hello,
I am using DB-Lib to bulk copy some data into a table that has an identity
column (set up to be used during replication). I don't think I want to
actually bind to an identity column with bcp_bind, do I? Is there any way t
o
skip that column?
Any help would be appreciated.
Ed Hoch
GEDDS Manager
Geophysical Institute
University of Alaska FairbanksHi
I have not used bulk copy and DB-lib, but I would expect that if the data is
included in the data file you still need to bind it but use 0 for the table
column see "Using a Data File with More Fields" in Books Online.
John
"Edward Hoch" <EdwardHoch@.discussions.microsoft.com> wrote in message
news:B4B4E323-3BD0-40BD-A9A0-734B1120A80F@.microsoft.com...
> Hello,
> I am using DB-Lib to bulk copy some data into a table that has an identity
> column (set up to be used during replication). I don't think I want to
> actually bind to an identity column with bcp_bind, do I? Is there any way
> to
> skip that column?
> Any help would be appreciated.
> Ed Hoch
> --
> GEDDS Manager
> Geophysical Institute
> University of Alaska Fairbanks
>|||Hi John,
Thanks for the reply. Unfortunately, it's not that my source data has
columns that I want to ignore, it's that my destination table has columns
that I want to "ignore", in the sense that the column holds uniqueidentifier
values that I don't know how to replace.
I guess I'll keep looking. Thanks again.
Ed
GEDDS Manager
Geophysical Institute
University of Alaska Fairbanks
"John Bell" wrote:

> Hi
> I have not used bulk copy and DB-lib, but I would expect that if the data
is
> included in the data file you still need to bind it but use 0 for the tabl
e
> column see "Using a Data File with More Fields" in Books Online.
> John
> "Edward Hoch" <EdwardHoch@.discussions.microsoft.com> wrote in message
> news:B4B4E323-3BD0-40BD-A9A0-734B1120A80F@.microsoft.com...
>
>|||Hi Ed
Translating from the BOL topic "Using a Data File with Fewer Fields" I would
expect the varlen to be -1 as well as the table_column being 0.
John
"Edward Hoch" <EdwardHoch@.discussions.microsoft.com> wrote in message
news:B23FF847-2610-4C30-8814-274CCEB63BD8@.microsoft.com...
> Hi John,
> Thanks for the reply. Unfortunately, it's not that my source data has
> columns that I want to ignore, it's that my destination table has columns
> that I want to "ignore", in the sense that the column holds
> uniqueidentifier
> values that I don't know how to replace.
> I guess I'll keep looking. Thanks again.
> Ed
> --
> GEDDS Manager
> Geophysical Institute
> University of Alaska Fairbanks
>
> "John Bell" wrote:
>|||One possibility you might want to try is to create a view on your
destination table that selects all columns except for the
uniqueidentifer column. You should then be able to bulk copy
directly into this view.

No comments:

Post a Comment