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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 How to show data for similar date

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-05-11 : 08:21:04
amar writes "hi,

I want to show data for same day. I have column which stores date and time. however when i try this

select vchr_name from tbl_employee where dte_time between '23/2/2005' and '23/2/2005

NOthing is returned.. PLease can you help me?"

nr
SQLTeam MVY

12543 Posts

Posted - 2006-05-11 : 08:31:40
where convert(datetime,convert(varchar(8),dte_time,112)) between '20050223' and '20050223'

or
where datediff(dd,dte_time,'20050223') = 0

or
where dte_time >= '20050223' and dte_time < '20050224'


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-05-11 : 09:17:50
To make use of index use nr's third query

Madhivanan

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

- Advertisement -