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)
 Trigger how to control the update

Author  Topic 

heartly
Starting Member

4 Posts

Posted - 2005-06-14 : 21:59:40
I have a problem here:
I want to create an update trigger where i can only update not more than 3 rows at one time.
For example; update a salary to the person who had $2000, then it only allow to update 3 person only. If it is more than 3, it will not update the salary and will give an error will be display.

heartly
Starting Member

4 Posts

Posted - 2005-06-14 : 23:39:12
i have found it
create trigger update4 ON [my table]
for update as
if @@rowcount>3
begin
rollback transaction
print ' No Way! You Dont Have These Authorities'
end
else
print'successful'
Go to Top of Page
   

- Advertisement -