SQL Server 2008 R2 & Entity Framework 6 incorrect syntax on inserts near ;

800 views Asked by At

My app is using the latest Entity Framework 6.0.1. It is adding a lot of objects to the database during it's load. I don't see any problems when it saves, if there were problems it should be erroring out my data and alerting me. However, I ran the Database Engine Tuning Advisor today and found some queries that look to be from entity framework auto generated inserts causing problems. I see data in the table, so if it happens it's very rare (I hope). Here's what the tuning advisor gave me.

declare @0 int;
declare @1 int;
declare @2 decimal(18;
declare 4);
declare @3 int;
declare @4 datetime2(7);
declare @5 int;
declare @6 datetime2(7);
INSERT [dbo].[ClaimAmount]([ClaimId], [ClaimServiceLineId], [ClaimPayerId],    [ClaimServiceLineAdjudicationId], [ClaimRepricingId], [ClaimDmeServiceId],     [ClaimAdjudicationId], [ClaimDiagnosisId], [AmountTypeId], [AdjustmentTypeId], [AmountQuantity], [AmountValue], [AdjustmentReasonCode], [InsertUserId], [InsertDate],    [UpdateUserId], [UpdateDate])
VALUES (NULL, @0, NULL, NULL, NULL, NULL, NULL, NULL, @1, NULL, NULL, @2, NULL, @3, @4, @5, @6)
SELECT [ClaimAmountId]
FROM [dbo].[ClaimAmount]
WHERE @@ROWCOUNT > 0 AND [ClaimAmountId] = scope_identity() 

[Microsoft][ODBC Driver 11 for SQL Server][SQL Server]
Incorrect syntax near ';'.
[Microsoft][ODBC Driver 11 for SQL Server][SQL Server]
Must declare the scalar variable "@2".

0

There are 0 answers