all groups > sql server odbc > january 2005 >
You're in the

sql server odbc

group:

Trouble with Primary key ater insert trigger


RE: Trouble with Primary key ater insert trigger Mike Epprecht (SQL MVP)
1/20/2005 7:51:02 AM
sql server odbc: Hi

Check that @@Identity is not used in the SP to retrieve the Identity value.
SCOPE_IDENTITY must be used as it is not affected by triggers.

Regards
Mike

[quoted text, click to view]
Trouble with Primary key ater insert trigger Günther Rühmann
1/20/2005 10:38:36 AM

Hello,

i habe some trouble with a sql 2000 appclication
The envisonment:
SQL-2000 - Server MS Access2000 - Client that uses SQL server tables via
ODBC.

After inserting a row to a table table_1 an insert trigger is running that
inserts some fields of this row to a second table tabel_2.
The MS Access client show use the primary key of the first insert in table_1
to add it to a new record in a detail table table_3.

The problem is: instead of insertig the primary key of detail table table_1
the primary key of table_3 (that has been inserted by the trigger on
table_1) is used.

The problem seems only to occur in multi user mode.

Anyone any idea ?

Re: Trouble with Primary key ater insert trigger Günther Rühmann
1/22/2005 12:43:16 PM
Hi, thanke for your answer.
As the front end application cannot be modified I am looking for another way
to avoid this problem.
Is there a way to configure ODBC - driver ?
I think a second possibility could be to take care that the records inserted
by the trigger has the same value in the primary key field as the primary
key field in the inserted record.


"Mike Epprecht (SQL MVP)" <mike@epprecht.net> schrieb im Newsbeitrag
news:6BDD5112-838E-4768-8426-23368F058803@microsoft.com...
[quoted text, click to view]

AddThis Social Bookmark Button