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
 Transact-SQL (2000)
 How to use trigger to update

Author  Topic 

ndindi22
Starting Member

14 Posts

Posted - 2007-08-23 : 08:38:33
Hi guys

How do I use trigger in MS SQL, I want to update another table every time there is change in another table.

e.g everytime the no_of_days table increament by 17, must add 1 to the leave_days table

or is there another way I can do this without using trigger


Ndindi22

ndindi22

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-08-23 : 08:49:04
quote:
or is there another way I can do this without using trigger

Yes. Use stored procedure.

Write a stored procedure to update the no_of_days table and in there perform the necessary logic and update the leave_days table accordingly when the criteria is met.


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

uday.sql
Starting Member

3 Posts

Posted - 2007-08-23 : 18:32:24
Write a update trigger on the parent table to handle successive update on the child table.
Go to Top of Page
   

- Advertisement -