Click here to Skip to main content
15,666,947 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,

I have created a table tblEmployee(employee detail) and tblLeaveDetail(EmpID,LeaveTaken,LeaveRemain).
I need to make a job by which every month there should be addition of two and half day in there remaining leaves. if a person is joining in that month after 15th then only 1 leave will get added.

please help.

Updated 4-Aug-11 1:58am
[no name] 4-Aug-11 7:52am    
"Here is one more question"
You can't assume everyone is following your every word and has any idea about previous questions. If the question is related to another, than ask it there. Otherwise, provide a full description as if this is your first question.
[no name] 4-Aug-11 7:55am    
Hey Mark
This is a new question.
[no name] 4-Aug-11 8:02am    
Here is one more Question means i have asked several question on which i got replies as well. I am very thankful to every one who helped me or tried helping me. this was is for them only. Hoping you'll not take me wrong way.

1 solution

I see a problem with your database design. Instead of storing 'Remaining leave' in a database column, you should ideally calculate it every time the value is required based on the current date and month.

If you still wish to proceed with your design, I would suggest you create a stored procedure that updates the leave balance and call this stored procedure from an SQL job that runs on specific intervals. Your logic can still be wrong if the stored procedure is run more than once during the same interval, unless of course you take precautions to avoid multiple updates to leave balances.
Share this answer
[no name] 4-Aug-11 8:30am    
Thanks Shameel, if you can give some logic for Storeprocedure. that will be great.
[no name] 5-Aug-11 4:10am    
I have got the desired solution.but thanks Shameel to guide me.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900