|
From: Dave on 18 Jun 2008 15:40 I'm using the SqlBulkCopy object to bulk insert large DataTable's into SQL Server. Its working well except tables with IDENTITY columns in them. When calling SqlBulkCopy.WriteToServer(DataTable) - I hit the following error "The given value of type String from the data source cannot be converted to type bigint of the specified target column." I tried removing the IDENTITY column from the table and it went in fine. Most unfortunate as I really need this to work on all tables, including those with identity cols. Does anyone have any idea how to get around this?? thanks, dave
From: Dave on 18 Jun 2008 18:07 On Jun 18, 12:40 pm, Dave <djohanns...(a)gmail.com> wrote: > I'm using the SqlBulkCopy object to bulk insert large DataTable's into > SQL Server. Its working well except tables with IDENTITY columns in > them. > > When calling SqlBulkCopy.WriteToServer(DataTable) - I hit the > following error "The given value of type String from the data source > cannot be converted to type bigint of the specified target column." > > I tried removing the IDENTITY column from the table and it went in > fine. Most unfortunate as I really need this to work on all tables, > including those with identity cols. > > Does anyone have any idea how to get around this?? > > thanks, dave this group doesn't get much activity so I better reply to myself. :D when source columns don't match up exactly with destination columns, SqlBulkCopyColumnMapping object is needed to specify mappings. I.e. like when there are ID cols. dave
|
Pages: 1 Prev: SQL 2008 EULA and pricing Next: Performing multiple bulkcopies for different tabels |