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
 General SQL Server Forums
 New to SQL Server Programming
 need to eliminate the time stamp

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.PRICE
FROM 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.CUST
WHERE IDST_EVENT_ORDERS.ORDATE BETWEEN @start AND @end
ORDER BY IDST_EVENT_ORDERS.ORDATE

---------------

result for the field trying to change
ORDATE
1/1/2014 12:00:00 AM

I Only want to see the date

please help



none

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 Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

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
Go to Top of Page

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 Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2014-02-22 : 10:42:21
If you don't worry about the formation, use

dateadd(day,datediff(day,0,date_col),0)

Madhivanan

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

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
Go to Top of Page

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 onwards

Madhivanan

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

- Advertisement -