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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Format Date

Author  Topic 

blackX
Posting Yak Master

102 Posts

Posted - 2009-08-20 : 09:41:38
I would like to return a date something like

Thursay August 20, 2009

How can this be achieved?

Travis

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2009-08-20 : 10:07:30

select
StringDate =
convert(varchar(28),datename(dw,DT)+' '+datename(month,DT)+' '+datename(day,DT)+', '+datename(year,DT)),
DT
from
( --Test Data
select DT= convert(datetime,'20090820') union all
select DT= convert(datetime,'20090916')
) a


Results:
StringDate                   DT
---------------------------- -----------------------
Thursday August 20, 2009 2009-08-20 00:00:00.000
Wednesday September 16, 2009 2009-09-16 00:00:00.000

(2 row(s) affected)



CODO ERGO SUM
Go to Top of Page
   

- Advertisement -