Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trigger & identity column
Message
From
08/04/2002 17:41:44
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
Other
Title:
Trigger & identity column
Miscellaneous
Thread ID:
00642396
Message ID:
00642396
Views:
56
Hi,

I am having an identity problem in the inserted table
(the one whit the trigger).

When i include the 2 INSERT INTO statements, in my
trigger, my identity column in my table dosen't get
updated immediately. And when i take them away it works
fine.

Let say i open my table in the Enteprise Manager and
add a row. When i change row to add my new row and
fire my trigger my identity column dosen't get updated
i have to manuelly call a refresh. It give me the same
problem when i add a row whit Visual Basic, SQL Server
dosen't give me back the new identity.
Why?

I have included my trigger.

CREATE TRIGGER tg_ProEnt_Insert ON [dbo].[Pro_Ent]
AFTER INSERT
AS

BEGIN

DECLARE @intPro_NRI INTEGER;
DECLARE @intEnt_NRI INTEGER;

IF @@ROWCOUNT = 0 RETURN

SELECT @intPro_NRI = Pro_NRI,
@intEnt_NRI = Ent_NRI
FROM INSERTED

INSERT INTO InvProEnt (IPE_Bris, Pro_NRI, Ent_NRI)
VALUES (0, @intPro_NRI, @intEnt_NRI)

INSERT INTO InvProEnt (IPE_Bris, Pro_NRI, Ent_NRI)
VALUES (1, @intPro_NRI, @intEnt_NRI)

END
Next
Reply
Map
View

Click here to load this message in the networking platform