Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CA - AutoRefresh
Message
From
06/09/2005 17:09:34
 
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro Beta
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
00955384
Message ID:
01047166
Views:
19
>Hi Aleksey,
>
>I'm doing some tests here and I find a problem.
>If I have two tables T1 and T2, and the table T1 fires a trigger that inserts a new row in T2, when you try to recovery @@identity, you get a wrong number.
>
>
>USE tempdb
>GO
>CREATE TABLE T1 (
>   Z_id  int IDENTITY(1,1)PRIMARY KEY,
>   Z_name varchar(20) NOT NULL)
>
>INSERT T1
>   VALUES ('Lisa')
>INSERT T1
>   VALUES ('Mike')
>INSERT T1
>   VALUES ('Carla')
>
>CREATE TABLE T2 (
>   Y_id  int IDENTITY(100,5)PRIMARY KEY,
>   Y_name varchar(20) NULL)
>
>INSERT T2 (Y_name)
>   VALUES ('boathouse')
>INSERT T2 (Y_name)
>   VALUES ('rocks')
>INSERT T2 (Y_name)
>   VALUES ('elevator')
>
>CREATE TRIGGER T1_trig
>ON T1
>FOR INSERT AS
>   BEGIN
>   INSERT T2 VALUES ('')
>   END
>
>
>The properties below will set the fields
>
>oCA.InsertCmdRefreshFieldList = "z_id"



oCA.InsertCmdRefreshCmd="SELECT SCOPE_IDENTITY()"




>
>
>When if you try it, you will get the wrong number (T2 identity).
>
>Maybe I'm doing something wrong here...
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform