From: jpBless on
I havedate/time field that stores value like 2010-4-10 00:00:00

I need to get the month and year like Apr-2010 or April-2010

I tried...
(DATEPART(MONTH,WRKODR.DateDel) + DATEPART(Year, WRKODR.DateDel)) As MTYr

It returns 2010 in some cases 2011... I think it just add month to year... I
need help

Thanks in advance






From: jpBless on
After more googling I tried

(DateName(Month, WRKODR.DateDel) + ' ' + DateName(Year, WRKODR.DateDel)) As
MTYr

It pulls date and month correctly as in April 2010

Any "inherent danger" in using datename?





"jpBless" <jp3blessNoSpam(a)hotmail.com> wrote in message
news:On4z6%23O2KHA.5212(a)TK2MSFTNGP04.phx.gbl...
>I havedate/time field that stores value like 2010-4-10 00:00:00
>
> I need to get the month and year like Apr-2010 or April-2010
>
> I tried...
> (DATEPART(MONTH,WRKODR.DateDel) + DATEPART(Year, WRKODR.DateDel)) As MTYr
>
> It returns 2010 in some cases 2011... I think it just add month to year...
> I need help
>
> Thanks in advance
>
>
>
>
>
>


From: Plamen Ratchev on
The DATENAME is a good way to get the month.

--
Plamen Ratchev
http://www.SQLStudio.com
From: jpBless on
Thanks... much appreciated

"Plamen Ratchev" <Plamen(a)SQLStudio.com> wrote in message
news:xcGdnT_m2sFtbl3WnZ2dnUVZ_qKdnZ2d(a)speakeasy.net...
> The DATENAME is a good way to get the month.
>
> --
> Plamen Ratchev
> http://www.SQLStudio.com


From: John Bell on
On Sat, 10 Apr 2010 17:05:40 -0400, "jpBless"
<jp3blessNoSpam(a)hotmail.com> wrote:

>After more googling I tried
>
>(DateName(Month, WRKODR.DateDel) + ' ' + DateName(Year, WRKODR.DateDel)) As
>MTYr
>
>It pulls date and month correctly as in April 2010
>
>Any "inherent danger" in using datename?
>
>
>
>
>
>"jpBless" <jp3blessNoSpam(a)hotmail.com> wrote in message
>news:On4z6%23O2KHA.5212(a)TK2MSFTNGP04.phx.gbl...
>>I havedate/time field that stores value like 2010-4-10 00:00:00
>>
>> I need to get the month and year like Apr-2010 or April-2010
>>
>> I tried...
>> (DATEPART(MONTH,WRKODR.DateDel) + DATEPART(Year, WRKODR.DateDel)) As MTYr
>>
>> It returns 2010 in some cases 2011... I think it just add month to year...
>> I need help
>>
>> Thanks in advance
>>
>>
>>
Formatting should really be done on the client!

John