Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UDF

Status
Not open for further replies.

darude

Programmer
Jun 23, 2003
138
0
0
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.
 
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'))
 
Thank you, I'll try it. I meant October 1.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top