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)
 Calculating Pay Periods

Author  Topic 

ninel
Posting Yak Master

141 Posts

Posted - 2005-06-17 : 17:16:48
The pay period at my company is from sunday to saturday.
How can I calculate these pay periods for the next 5 years.

Example:

StartPeriod EndPeriod
20050612 20050618
20050619 20050625
20050626 20050702

Thanks,
Ninel

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2005-06-17 : 18:05:02
Using the function in this topic below to give you a table of numbers, this code will do it

Function F_TABLE_NUMBER_RANGE
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=47685



select
StartPeriod = dateadd(dd,NUMBER*7,'2005-06-12'),
StartPeriod = dateadd(dd,(NUMBER*7)+6,'2005-06-12')
from
dbo.F_TABLE_NUMBER_RANGE(0,270)
order by
NUMBER




CODO ERGO SUM
Go to Top of Page
   

- Advertisement -