dbTalk Databases Forums  

Formating database DateTime to Date

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Formating database DateTime to Date in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Hitz
 
Posts: n/a

Default Formating database DateTime to Date - 03-05-2004 , 04:21 AM






Hi guys

I am using Sql Server2k. In the database i have one field called 'orderdate' as datetime. Now, i want to compare the 'orderdate' falling in a particular period of date. So, i am writing down the query for that which is as follows

select orderid,customerid,orderdate as orderdate from orders where orderdate='07/07/2003

Now, the outcome of this result is zero though i have got orders on this date. As, the value of orderdate is being stored as datetime i have to specify the datetime. But, is there any way to convert or format the database 'orderdate' to only date and not the time so i can search for that date. Any help would be appreciated



Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Formating database DateTime to Date - 03-05-2004 , 06:24 AM






Look up CONVERT in BOL


--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Hitz" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hi guys,

I am using Sql Server2k. In the database i have one field called
'orderdate' as datetime. Now, i want to compare the 'orderdate' falling in a
particular period of date. So, i am writing down the query for that which is
as follows:
Quote:
select orderid,customerid,orderdate as orderdate from orders
where orderdate='07/07/2003'

Now, the outcome of this result is zero though i have got orders
on this date. As, the value of orderdate is being stored as datetime i have
to specify the datetime. But, is there any way to convert or format the
database 'orderdate' to only date and not the time so i can search for that
date. Any help would be appreciated.
Quote:




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.