View Single Post

   
  #3 (permalink)  
Old 02-28-2008, 05:13 PM
Erland Sommarskog
 
Posts: n/a
Default Re: what is equivalent of format(date) function of MS Access in MS Sql Server 2000

Leader (sohelcsc@yahoo.com) writes:
> I am facing a problem with a sql what i used in MS Access but its not
> returning the same result in MS Sql Server 2000. Here i am giving the
> sql:
>
> SELECT TOP 3 format( MY_DATE, "dddd mm, yyyy" ) FROM MY_TAB WHERE
> MY_ID=1
>
> The above sql in ACCESS return me the date in below format in one
> column:
>
> Friday 09, 2003
>
> But in Sql server 2000 i am not getting the same format eventhough i
> am using convert function, date part function etc.


This gives you what you want:

select datename(dw, getdate()) + ' ' + datename(dd, getdate()) + ', ' +
datename(yyyy, getdate())

Well almost. You don't get any leading zero for a one-digit date.

--
Erland Sommarskog, SQL Server MVP, sommar@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Reply With Quote