Can't refresh delta, record isn't found

(eagle2010) #1

"A problem occured while inserting a record in table “bpINDet”, record “6"
Can’t refresh delta, record isn’t found.”

This error is produced after applying updates to a new set of data (master/detail).

When updating (modifying records) the error is not generated.

bpINDet is the detail table. Both tables use automatic key fields (MasterID and DetailID). Schema defines AutoInc for both key fields (In fact, the same logic is used successfully in other tables of the database).

Relationships are defined in the same manner as in other correct master/detail tables in the same schema. Apparently everything is defined according the rules of a “mmWhere” MasterMappingMode.

All records are successfully inserted into the database but the message is displayed when a refresh action is taking place, probably.

Database server: SQL Server 2008.

Thanks in advance,
Humberto Gutiérrez

(Vyacheslav Dulnev) #2


Can you send example of DDL for such tables, please?

(tobygroves) #3

Appreciate this is 7 years old but just bumped my head against it again so in case this helps anyone…

This happens when a new record is written with an IDENTITY primary key column, then the newly assigned value is retrieved from the database but it’s wrong.

This can happen if you have an insert trigger on the table which also inserts into another table (a log perhaps) which also has an IDENTITY column. In this case the @@IDENTITY value retrieved is that of the secondary table in the trigger, not the original table you inserted into.

For this reason you can’t insert into a table with an IDENTITY column from within a trigger.

I really wish they’d fix this by using @@SCOPEIDENTITY instead.

(EvgenyK) #4

how autoinc feature works in DA:

  • insert data
  • get inserted autoinc

SCOPE_IDENTITY() won’t work because these two sql are placed into different scopes

However you can update MSSQL_DoGetLastAutoInc method manually and use SCOPE_IDENTITY() or IDENT_CURRENT instead of @@IDENTITY.

(tobygroves) #5

Ah ok - not sure if I can work around the problem another way or not yet.

So you’re saying that SCOPE_IDENTITY won’t work but then saying I can change the MSSQL_DoGetLastAutoInc function to use it?

(EvgenyK) #6

it depends on your case.
for example, you may want to use IDENT_CURRENT if you have no concurrence problems.
if 2+ users can insert records in the same table in the same time, it won’t work too.

btw, you can put logic from trigger into DA server or DA can call stored procedure for inserting values.