We help IT Professionals succeed at work.

create trigger to reset value every one year in sql server

75 Views
Last Modified: 2017-04-15
Dear all brothers and sisters, i have a table "tbl_anualLeave" and default annual leave value for all user is 8, so when HR input amount of user take leave it will take that data to calculate with 8 and update the result to the table of that user,  no matter how user use all of their annual leave amount, the system will reset their current remain to 8 every (new year) - Jan -01, it mean that their annual leave will automatically reset to 8 every new year.  Thanks in advance
Comment
Watch Question

Nitin SontakkeDeveloper
CERTIFIED EXPERT

Commented:
You don't need a trigger for that. You need a scheduled job for that which is (obviously) scheduled to execute once in a year.
Sok DymangDeveloper

Author

Commented:
Oh, so can you tell me how?
Developer
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Vitor Montalv√£oIT Engineer
CERTIFIED EXPERT
Distinguished Expert 2017

Commented:
You don't need a trigger because a trigger isn't a scheduled task.
You'll need to create a SQL Agent job to run the necessary code to reset the required value.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.