PRB: Error Attempting to Insert Explicit Values with an Append QueryID: Q175624
|
An append query from a Microsoft Access 97, Access 95, or Access 2.0
database to a table in SQL Server 6.0 or SQL Server 6.5 may generate the
following message:
Attempting to insert explicit value for identity column in <tablename> when identity_insert is set to off.
Jet handles the append query request in a different way for rows when all the columns contain NULL values. For an example, see the MORE INFORMATION section of this article.
To work around this problem, make sure that the rows from the source table being inserted into the destination table do not have all NULL values. You can do this by adding the criteria "IS NOT NULL" for any particular column in the append query.
Suppose you have the following two tables:
Source table : TABLE_S with columns col1, col2, col3 allowing NULLs.
Destination table: TABLE_D with columns colA, colB, colC, colD with colA
being an IDENTITY column and the rest allowing null values.
Col1 and col2 from TABLE_S are being selected and appended to TABLE_D with
colB and colC as the corresponding columns.
In the normal case, when either col1 or col2 for a particular row has a non-
NULL value, the SQL statement that would go into SQL Server would be:
Insert into <owner>.TABLE_D (colB, colC) values (val1,val2)
Insert into <owner>.TABLE_D (colA,colB,colC,colD) values
(NULL,NULL,NULL,NULL)
Attempting to insert explicit value for identity column in <tablename>
when identity_insert is set to off.
Additional query words: col
Keywords : kbinterop SSrvGen
Version : WINNT:6.0 6.5
Platform : winnt
Issue type : kbprb
Last Reviewed: April 16, 1999