LambtonWorm
Registered User.
- Local time
- Today, 15:43
- Joined
- Jun 24, 2012
- Messages
- 12
Hi guys
An Access 2003 append query is failing due to 'key violations'. It is meant to append data from a linked csv file to a linked table in a SQL Server Database. The error message reads:
"MS Access...didn't add 1329 records to the table due to key violations.."
There are exactly 1329 records returned by the query, so this is all of them.
I cloned both the Access and SQL databases from the original production one, where presumably there is no such error. In particular I scripted the Primary and foreign keys from the original to the copy SQL SB.
I'm puzzled by the fact that in the SQL code nothing is being inserted into the target table primary key field (called 'Scrit_ID'). This must be the source of the problem, but why doesn't this cause a problem in Production?
Here's the SQL in Access
Any ideas?
thanks for reading
An Access 2003 append query is failing due to 'key violations'. It is meant to append data from a linked csv file to a linked table in a SQL Server Database. The error message reads:
"MS Access...didn't add 1329 records to the table due to key violations.."
There are exactly 1329 records returned by the query, so this is all of them.
I cloned both the Access and SQL databases from the original production one, where presumably there is no such error. In particular I scripted the Primary and foreign keys from the original to the copy SQL SB.
I'm puzzled by the fact that in the SQL code nothing is being inserted into the target table primary key field (called 'Scrit_ID'). This must be the source of the problem, but why doesn't this cause a problem in Production?
Here's the SQL in Access
Code:
PARAMETERS [Please Enter Data Date (dd/mm/yyyy):] DateTime;
INSERT INTO DEV_dbo_tbl_0000_SCRITTURA ( Scrit_InputDte, Scrit_InputOwner, Scrit_DealReference, Scrit_DataDte, Scrit_CounterpartyLongName, Scrit_CounterpartyID, Scrit_CounterpartyReference, Scrit_SalesPerson, Scrit_TemplateName, Scrit_ProductCategory, Scrit_ProductType, Scrit_DocEvent, Scrit_TradeType, Scrit_TradeStatus, Scrit_TradeDate, Scrit_ArrivalDate, Scrit_EventType, Scrit_ConfirmationMedium, Scrit_Portfolio, Scrit_CurrentManualQueue, Scrit_OurPartyLegalID, Scrit_TradeAge )
SELECT Now() AS InputDte, [Enter Username:] AS UserName, iif(isnull([Deal Reference]),'',[Deal Reference]) AS Expr1, [Please Enter Data Date (dd/mm/yyyy):] AS DataDte, lnk_Scrittura.[Counterparty Long Name], lnk_Scrittura.[Counterparty ID], lnk_Scrittura.[Counterparty Reference], lnk_Scrittura.SalesPerson, lnk_Scrittura.[Template Name], lnk_Scrittura.[Product Category], lnk_Scrittura.[Product Type], lnk_Scrittura.Field6, lnk_Scrittura.[Trade Type], lnk_Scrittura.[Trade Status], lnk_Scrittura.[Trade Date], lnk_Scrittura.[Scrittura Arrival Date], lnk_Scrittura.[Event Type], lnk_Scrittura.[Confirmation Medium], lnk_Scrittura.Portfolio, lnk_Scrittura.[Current Manual Queue], lnk_Scrittura.[Our Party Legal ID], lnk_Scrittura.[Trade Age]
FROM lnk_Scrittura;
Any ideas?
thanks for reading