all groups > sql server dts > march 2004 >
You're in the

sql server dts

group:

Formating database DateTime to Date


Formating database DateTime to Date Hitz
3/5/2004 2:21:06 AM
sql server dts:
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

Re: Formating database DateTime to Date Allan Mitchell
3/5/2004 12:24:03 PM
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


[quoted text, click to view]
'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:
[quoted text, click to view]
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.
[quoted text, click to view]

AddThis Social Bookmark Button