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 |
|
shemayb
Posting Yak Master
159 Posts |
Posted - 2007-12-19 : 17:12:59
|
| i have this query: SELECT top 1 DATEADD(year, -2, @sDate)AS ydate which returns 2005-01-01 00:00:00.000,how can i remove the time values and only display the date?thanks!Funnyfrog |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-12-19 : 17:18:58
|
| You can chop it off via CONVERT function with the appropriate style. But you should be handling this at the presentation layer instead of at the database layer.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
shemayb
Posting Yak Master
159 Posts |
Posted - 2007-12-19 : 17:51:45
|
| I changed my query to this one,SELECT DATEADD(year, -2, convert(char,@sDate,107)) AS ydate..but the result is still 2005-01-01 00:00:00.000...what is wrong with my query?Funnyfrog |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-12-19 : 17:54:06
|
SELECT CONVERT(CHAR(10), DATEADD(YEAR, -2, @sDate), 112) E 12°55'05.25"N 56°04'39.16" |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-12-20 : 01:35:28
|
quote: Originally posted by shemayb i have this query: SELECT top 1 DATEADD(year, -2, @sDate)AS ydate which returns 2005-01-01 00:00:00.000,how can i remove the time values and only display the date?thanks!Funnyfrog
Where do you want to show data?MadhivananFailing to plan is Planning to fail |
 |
|
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
|
|
|
|
|
|
|