Re: Unable to bcp file into MS SQL Server 2008
Srdan Dukic <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
I see. So how would you do that? I've been looking at the freebcp man page[1] but can't really see any option or example of how to specify that any identity fields should be ignored. In the load file I've tried setting a '0' and also tried setting it to 'NULL', '?' and just leaving the field blank, but with these approaches, it gives me an error: Msg 20073, Level 2 Attempt to bulk copy a NULL value into a Server column which does not accept null values Thank you [1] http://linux.die.net/man/1/freebcp On 30 January 2010 03:19, Bob Hetzel <[email protected]> wrote: > It's actually my understanding that if you don't turn on identity insert, > you have to actually tell it to ignore any identy fields in your load file. > > Bob > > Srdan Dukic wrote: >>> >>> On Thu, Jan 28, 2010 at 7:44 PM, Srdan Dukic <[email protected]> >>> wrote: >>> >>>> Hi, >>>> >>>> We've recently upgraded from SQL Server 2005 to 2008 and have >>>> encountered a strange error when trying to use freebcp to insert data >>>> into a table. The table schema is identical, the only thing having >>>> changed being the version of ms sql. >>>> >>>> The error is: >>>> >>>> Msg 2627, Level 14, State 1 >>>> Server 'ARCHIVESERVER', Line 1 >>>> Violation of PRIMARY KEY constraint 'PK_log_failure'. Cannot >>>> insert duplicate key in object 'dbo.log_failure'. >>>> Msg 2627, Level 14 >>>> General SQL Server error: Check messages from the SQL Server >>>> >>>> Msg 3621, Level 0, State 0 >>>> Server 'ARCHIVESERVER', Line 1 >>>> The statement has been terminated. >>>> 10 rows copied. >>>> >>>> >>>> The primary key field is a 'bigint', and is also an identity >>>> specification with a seed of 1 and an increment of 1 (pretty >>>> standard). >>>> >>>> When I insert, the the id field I put a '0' (zero), the actual line >>>> being: >>>> >>>> 0 B7/EA-09234-2552D5B4 2010-01-25 00:00:02 3 65535 >>>> 0 [Log text line here] >>>> >>>> Where the first value is the 'id'column in question. >>>> >>>> Has anyone had this problem before? >>>> >>>> >>>> Thank you >>>> -- >>>> Srđan Đukić >>>> _______________________________________________ >>>> FreeTDS mailing list >>>> [email protected] >>>> http://lists.ibiblio.org/mailman/listinfo/freetds >>>> >>> _______________________________________________ >>> FreeTDS mailing list >>> [email protected] >>> http://lists.ibiblio.org/mailman/listinfo/freetds >>> >> >> On 29 January 2010 16:54, Robert Hetzel <[email protected]> wrote: >>> >>> There is an identity insert property which may be different than you >>> expect. If it's set to allow you to insert values in that field rather >>> than >>> auto-generate a value, then that would explain the key violation. >>> >>> Bob >> >> Hi Bob, >> >> I'm running the command without the '-E' flag which I believe is the >> one which allows you to insert pre-generated values into the table. I >> *want* the database engine to generate the 'id' column, but I'm still >> getting this error. >> >> > -- Srđan Đukić _______________________________________________ FreeTDS mailing list [email protected] http://lists.ibiblio.org/mailman/listinfo/freetds