we have implemented DB detection.

Our table RelationshipList has an insert trigger inserting a record in a signal table : RelationshipList_Changes

The RelationshipList table primary key is a Identity column (int), ClientID.

Since we have implemented the Insert trigger, the SQL Statement (in GeniusConnect Primary/Mandatory keys dialog)returns wrong value: select @@IDENTITY returns now last value of RelationshipList_Changes (column TranNr)record instead of last value in RelationshipList ?


the 'select @@IDENTITY' returns last IDENTITY after the insert, in your case, last IDENTITY value is value of the record inserted into the RelationshipList_Changes.

-Example steps:
1. insert records to RelationshipList table
2. database generates new IDENTITY value for new record in RelationshipList table
3. Your insert trigger executes insert to RelationshipList_Changes table
4. database generates new IDENTITY value for new record in RelationshipList_Changes table
5. Your statement 'select @@IDENTITY' returns value of last IDENTITY in RelationshipList_Changes

Please change your SQL Statement in GeniusConnect Primary/Mandatory keys dialog to:
select ClientID from RelationshipList_Changes where TranNr=@@IDENTITY
Similar Topics