Jul 9, 2009 #1 darude Programmer Jun 23, 2003 138 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 Apr 30, 2001 323 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 Jun 23, 2003 138 US Thank you, I'll try it. I meant October 1. Upvote 0 Downvote