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.
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 helpThanks |
|
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, likeselect * from table1 where col1 >= '2008-12-01' -- yyyy-mm-dd <- not so great i germanyselect * from table1 where col1 >= '20081201' -- yyyymmdd <- this is prefereable E 12°55'05.63"N 56°04'39.26" |
|
|
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 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-02-16 : 23:07:32
|
u don't want the timepart in ur datetimetry thisselect 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 |
|
|
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 helpThanks
What is the datatype of the date column?MadhivananFailing to plan is Planning to fail |
|
|
|
|
|