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)
 SQL server 7.0

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-07-28 : 07:11:09
Som writes "I would like to know as how to use a trigger for a specified condition in SQL 7.0. I want this update trigger to fire if only one row in a table gets updated. For the rest of the rows, this trigger should not do nothing.
This is on SQL 7.0 on windows NT and 2000 platforms.

Any help or code would be greatly apprecited. Thanks."

nr
SQLTeam MVY

12543 Posts

Posted - 2003-07-28 : 07:32:42
create trigger tr on tbl for update
as
if 1 = (select count(*) from inserted)
begin
-- do stuff here
end

go


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2003-07-28 : 10:10:12
quote:
Originally posted by nr

create trigger tr on tbl for update
as
if 1 = (select count(*) from inserted)
begin
-- do stuff here
end



Nigel,

I know you always do stuff for a reason, but why the existance check in the format specified.

I would have thought it would be the other way around?

if (select count(*) from inserted) = 1

Gotta be a reason...no?






Brett

8-)
Go to Top of Page
   

- Advertisement -