From: Patrice on
The result depends on the language settings + if you want to sort on this
column, you'll now have just text...

My personal preference is to always return the actual column (in particular
under its actual datatype) and to do formatting client side...

--
Patrice


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

From: jpBless on
I wanted to format the date on server side because of sorting

"John Bell" <jbellnewsposts(a)hotmail.com> wrote in message
news:rtv2s51kgt992rim3eet1ka1safmbd3i3o(a)4ax.com...
> 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


From: John Bell on
On Mon, 12 Apr 2010 12:58:43 -0400, "jpBless"
<jp3blessNoSpam(a)hotmail.com> wrote:

>I wanted to format the date on server side because of sorting
>

Unless you want alphabetical sorting (but for dates that doesn't make
a great deal of sense!), then converting the date shouldn't be
necessary.

John
From: jpBless on
I see! Thanks for the info


"John Bell" <jbellnewsposts(a)hotmail.com> wrote in message
news:8247s59qru7c57ejl1n7d7ornrkf9ua1fu(a)4ax.com...
> On Mon, 12 Apr 2010 12:58:43 -0400, "jpBless"
> <jp3blessNoSpam(a)hotmail.com> wrote:
>
>>I wanted to format the date on server side because of sorting
>>
>
> Unless you want alphabetical sorting (but for dates that doesn't make
> a great deal of sense!), then converting the date shouldn't be
> necessary.
>
> John