By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,483 Members | 1,001 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,483 IT Pros & Developers. It's quick & easy.

Last Year Month to Date Function

P: n/a
I have been spoiled by some report writing tools that have intrinsic
functions like Last Year Month-to-date. I'm looking for a way to emulate
this in SQL Server now with my fields that are date/time.

I'm thinking I need to develop a user defined function to accept a date
input parameter, but I don't know where to start.

Help/Examples appreciated.

Thanks,
Frank
*** Sent via Developersdex http://www.developersdex.com ***
Feb 16 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi, Frank

If you have a date and you want to obtain the corresponding date in the
previous year, you can use the DATEADD function, like this:
DATEADD(year, -1, @TheDate). For more informations, see:
http://msdn.microsoft.com/library/en...fa-fz_2c1f.asp

Razvan

Feb 16 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.