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.
Author |
Topic |
ndindi22
Starting Member
14 Posts |
Posted - 2007-08-16 : 06:07:24
|
Can someone plz help me.I'm working on leave application, have to calculate number of leave days available, starting from Startdate to Enddate of a contract. Where an employee get 1 day leave after 17 days from startdate of contract. How do I calculate the leave days, that accrue every after 17 days by 1.I'm using ASP and SQL Server 2000 (Query Analyzer)ndindi22ndindi22 |
|
ditch
Master Smack Fu Yak Hacker
1466 Posts |
|
ashley.sql
Constraint Violating Yak Guru
299 Posts |
Posted - 2007-08-16 : 08:34:40
|
you need to follow the logicor maybe you can divide the difference between enddate and startdate by 17 and use the quotient as the number of days of leaveso if someone worked for 100 daysselect datediff(d, '1/15/2007', '4/25/2007')/17 here you will get 5but you will useselect datediff(d, startdate, enddate)/17 as 'NUMBER OF LEAVES'Ashley Rhodes |
|
|
ashley.sql
Constraint Violating Yak Guru
299 Posts |
Posted - 2007-08-16 : 08:36:32
|
also you did not mention if its 17 business days or just 17 days.If its business days its different and can be done with a function which calculates business days between 2 datesand then you can divide that number by 17.Ashley Rhodes |
|
|
|
|
|