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

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to extract month and year

Author  Topic 

siumui
Yak Posting Veteran

54 Posts

Posted - 2012-03-28 : 16:12:40

Hello all.

I want to get the month and year only, but I don't know how.
For example:
If the Date is from 02/01/11 to 02/28/11, I want it to be Feb-11.
If the Date is from 03/01/11 to 03/30/11, I want it to be Mar-11.

Same goes for all other months.

Please help.

Thank you.


siumui

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-03-28 : 16:13:55
have a look at date functions MONTH()and YEAR() in books online
if you want it in text, use DATENAME
------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

siumui
Yak Posting Veteran

54 Posts

Posted - 2012-03-28 : 16:15:37
quote:
Originally posted by visakh16

have a look at date functions MONTH()and YEAR() in books online
if you want it in text, use DATENAME
------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/





Ok. Thank you.


siumui
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-03-28 : 16:29:59
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -