Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 HELP IN TRIGGER UPDATE/INSERT

Author  Topic 

DiceK-BadMan
Starting Member

12 Posts

Posted - 2008-05-16 : 05:03:33
Hi,

I just test the trigger query lately,and there was a problem. For example I have tblprojectsample & tblprojectsample1

I used trigger and this is the query

CREATE trigger ProjectInsert
on tblprojectsample1
INSTEAD OF INSERT
AS
BEGIN
INSERT tblprojectsample SELECT PROJECTID,DB,URL,STATUS,MAXTARGET,DISABLEFV,MUSTGETEMAIL,SVRNAME,DBNAME,OUTSOURCE,[TIME]
FROM inserted
END

whenever I add new row to tblprojectsample1, tblprojectsample also updated but when i tried to check the row or "projectid" in tbleprojectsample1 It results nothing. Can anyone pls explain what happen when I run the query in trigger?I want to update both tables is this possible?but how?

thanks

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2008-05-16 : 08:00:14
Have you read about triggers in Books Online? You've chosen to use INSTEAD OF INSERT rather than AFTER INSERT.
As the event implies INSTEAD OF performs the action of the trigger INSTEAD of performing the insert.

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -