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 |
maggie21620
Starting Member
27 Posts |
Posted - 2014-02-21 : 12:17:43
|
with this qry i need to only show in the result for ordate the date and not the time stamp, can anyone assist. below is my qry and the first line of the results:SELECT DISTINCT adHock.dbo.PPVVINCE$.Corps, adHock.dbo.PPVVINCE$.House, adHock.dbo.PPVVINCE$.Cust, IDST_EVENT_ORDERS.ORDATE, IDST_EVENT_ORDERS.ORTIME, IDST_EVENT_ORDERS.EVWMIN, IDST_EVENT_ORDERS.EVTDES, IDST_EVENT_ORDERS.EVENT_OUTLETS, IDST_EVENT_ORDERS.VIEWTYPE, IDST_EVENT_ORDERS.LAST_UPDATE_DATE, IDST_EVENT_ORDERS.PRICEFROM adHock.dbo.PPVVINCE$ INNER JOIN infoddp.dbo.IDST_EVENT_ORDERS ON adHock.dbo.PPVVINCE$.Corps = IDST_EVENT_ORDERS.ACCTCORP AND adHock.dbo.PPVVINCE$.House = IDST_EVENT_ORDERS.HOUSE AND adHock.dbo.PPVVINCE$.Cust = infoddp.dbo.IDST_EVENT_ORDERS.CUSTWHERE IDST_EVENT_ORDERS.ORDATE BETWEEN @start AND @endORDER BY IDST_EVENT_ORDERS.ORDATE---------------result for the field trying to changeORDATE1/1/2014 12:00:00 AMI Only want to see the dateplease helpnone |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-02-21 : 12:27:25
|
You can use the CONVERT function with the appropriate style to format that column, however this is a presentation layer issue. The formatting should be done in your application and not in TSQL.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
maggie21620
Starting Member
27 Posts |
Posted - 2014-02-21 : 14:34:27
|
thank you that worked fine now i want to remove the date and leave the time for another column.none |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-02-21 : 14:41:07
|
CONVERT with the appropriate style works for that too, or better yet do this in the application code.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2014-02-22 : 10:42:21
|
If you don't worry about the formation, usedateadd(day,datediff(day,0,date_col),0)MadhivananFailing to plan is Planning to fail |
|
|
kennejd
Starting Member
11 Posts |
Posted - 2014-02-26 : 15:26:34
|
You can also use the cast function:select cast(getdate() as date) as sdate, cast(getdate() as time) as stime |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2014-03-05 : 08:00:13
|
quote: Originally posted by kennejd You can also use the cast function:select cast(getdate() as date) as sdate, cast(getdate() as time) as stime
Yes but supported from version 2008 onwardsMadhivananFailing to plan is Planning to fail |
|
|
|
|
|
|
|