luckroth
October 25th, 2006, 03:55 AM
hi all. i want a trigger that can do in loop. for example:
it is recursive trigger.
---------------------------------------------------------------------------------------
CREATE TRIGGER UpdateStudent On tblStudent FOR Update as
DECLARE @studentid int
SELECT @studentid=studentReg FROM tblStudent WHERE Status=2
UPDATE tblStudent SET Status=2 WHERE StudentID=@StudentID
UPDATE tblStudent SET Status=0 WHERE StudentReg=@StudentID
-----------------------------------------------------------------------------------------
if in tblstudent still have status =2, this trigger will never end.
could anyone help me please?
it is recursive trigger.
---------------------------------------------------------------------------------------
CREATE TRIGGER UpdateStudent On tblStudent FOR Update as
DECLARE @studentid int
SELECT @studentid=studentReg FROM tblStudent WHERE Status=2
UPDATE tblStudent SET Status=2 WHERE StudentID=@StudentID
UPDATE tblStudent SET Status=0 WHERE StudentReg=@StudentID
-----------------------------------------------------------------------------------------
if in tblstudent still have status =2, this trigger will never end.
could anyone help me please?