Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Create Function to find sunday and add that sunday
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

1 Posts

Posted - 12/22/2012 :  07:56:23  Show Profile  Reply with Quote
I need to create a function that accept parameter as date and number,
add that number in date and find how many Sunday in that between and again add that Sunday in date and give that date .. it will be recursive..

plz proved the logic for that


Flowing Fount of Yak Knowledge

5155 Posts

Posted - 12/22/2012 :  09:18:53  Show Profile  Reply with Quote
I was following what you are asking for until " will be recursive". Can you explain with some sample data? You can try using the following:

Edited by - sunitabeck on 12/22/2012 09:19:36
Go to Top of Page

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 12/22/2012 :  13:25:32  Show Profile  Reply with Quote
see this to understand logic behind integer arithmetic of dates

SQL Server MVP

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000