SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 need to eliminate the time stamp
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

maggie21620
Starting Member

USA
27 Posts

Posted - 02/21/2014 :  12:17:43  Show Profile  Reply with Quote
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

USA
37466 Posts

Posted - 02/21/2014 :  12:27:25  Show Profile  Visit tkizer's Homepage  Reply with Quote
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

USA
27 Posts

Posted - 02/21/2014 :  14:34:27  Show Profile  Reply with Quote
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

USA
37466 Posts

Posted - 02/21/2014 :  14:41:07  Show Profile  Visit tkizer's Homepage  Reply with Quote
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

India
22772 Posts

Posted - 02/22/2014 :  10:42:21  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
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

USA
11 Posts

Posted - 02/26/2014 :  15:26:34  Show Profile  Reply with Quote
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

India
22772 Posts

Posted - 03/05/2014 :  08:00:13  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.12 seconds. Powered By: Snitz Forums 2000