Jul 9, 2009 #1 darude Programmer Joined Jun 23, 2003 Messages 138 Location US Hello, I would need to create a UDF where if I feed it the current year it returns 10/1 of the previous year. Is this possible? Thank you in advance.
Hello, I would need to create a UDF where if I feed it the current year it returns 10/1 of the previous year. Is this possible? Thank you in advance.
Jul 9, 2009 #2 RyanEK Programmer Joined Apr 30, 2001 Messages 323 Location AU Do you mean 10th of January or 1st of October? In any case, here is one of many ways to do this... Code: declare @year int set @year = 2009 select dateadd(yy,-1, convert(datetime,cast(@year as varchar) + '-10-1')) Upvote 0 Downvote
Do you mean 10th of January or 1st of October? In any case, here is one of many ways to do this... Code: declare @year int set @year = 2009 select dateadd(yy,-1, convert(datetime,cast(@year as varchar) + '-10-1'))
Jul 10, 2009 Thread starter #3 darude Programmer Joined Jun 23, 2003 Messages 138 Location US Thank you, I'll try it. I meant October 1. Upvote 0 Downvote