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)
 Update Trigger

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-02-12 : 07:53:14
aaron writes "I would like to insert a new row if the update fails

This is what I have so far but I am not sure if I can access the values from the update to use in the insert.

CREATE TRIGGER ClientIdUpdate ON [dbo].[newtracking]
FOR UPDATE
AS
Declare @@clientid varchar(20)

IF (select count(*) from inserted) > 0
return
else
Insert into newtracking (clientid) select clientid from inserted"

Stoad
Freaky Yak Linguist

1983 Posts

Posted - 2004-02-12 : 08:02:36
Trigger is a kind of post-filter and it is envoked
only if an update statement was successful.
Go to Top of Page
   

- Advertisement -