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)
 date function calculation

Author  Topic 

willdevelope
Starting Member

1 Post

Posted - 2006-01-06 : 17:00:29
Return a date (This is a calculated date based on the input arguments) It need to Take 3 arguments
Starting Date (Date) (Example 10/10/2005)
Increment (integer) (Example è +4 or -3)
Day of the Week (Varchar)
(Example Monday or Thursday)


Example: If I need to calculate the 5th Monday after 10/10/2005 I will call the function like this è

Exec fnCalculateNewDate @startDate= ‘10/10/2005’, @Increment=+5, @DayOfTheWeek=’Monday’

If I need to calculate 4th Sunday before ‘10/10/2005, I will call the function line this

Exec fnCalculateNewDate @startDate= ‘10/10/2005’, @Increment=-4, @DayOfTheWeek=’Sunday’

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-01-06 : 17:37:25
Can you post the code that you have for this function so far? It smells of homework otherwise.

Tara Kizer
aka tduggan
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-01-06 : 19:09:44
This function may not do exactly what you want, but you can easily adapt it to suit your needs. I’ll leave that to you.

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=59927






CODO ERGO SUM
Go to Top of Page
   

- Advertisement -