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
 SQL Server Development (2000)
 DAte format

Author  Topic 

korssane
Posting Yak Master

104 Posts

Posted - 2009-02-16 : 11:16:58
HI Guys,
I am a newbee and using MS SQL 2005. I have a field called dateofevent formmated : mm-dd-yyyy in a specific table.
I want just to call this f ield in a query uising this format ( mm-dd-yyyy).
please any help
Thanks

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-02-16 : 11:26:10
If the datatype is datetime, you can always use ISO standard, like

select * from table1 where col1 >= '2008-12-01' -- yyyy-mm-dd <- not so great i germany
select * from table1 where col1 >= '20081201' -- yyyymmdd <- this is prefereable


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

korssane
Posting Yak Master

104 Posts

Posted - 2009-02-16 : 12:56:01
Thanks for the quick reply
but that is not what i what .
i already have the date formatted to : mm-dd-yyyy hh:mm:ss . All what i want is to call it in another format "mm-dd-yyyy"

thanks
Go to Top of Page

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2009-02-16 : 23:07:32
u don't want the timepart in ur datetime
try this
select dateadd(dd,datediff(dd,0,getdate()),0)
select replace(convert(varchar(32),getdate(),101),'/','-')
but it is no better to use the datetime value into varchar field use the 1st query than the 2nd one
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-02-17 : 01:32:53
quote:
Originally posted by korssane

HI Guys,
I am a newbee and using MS SQL 2005. I have a field called dateofevent formmated : mm-dd-yyyy in a specific table.
I want just to call this f ield in a query uising this format ( mm-dd-yyyy).
please any help
Thanks



What is the datatype of the date column?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -