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)
 use date criteria in sort

Author  Topic 

sachingovekar
Posting Yak Master

101 Posts

Posted - 2010-07-07 : 04:57:21
Hi,

I have a table which has date column. the data is stored in date and time.

I want to fire the query on table to display rows.

create table #temp1 (importdate datetime)
insert into #temp1 values ('2010-06-26 03:04:12:234'
insert into #temp1 values ('2010-06-27 05:04:12:534'')
insert into #temp1 values (getdate())
insert into #temp1 values (getdate())

select * from #temp1 where importdate between '2010-06-27' and '2010-07-07'

Regards,
sachin

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-07-07 : 04:59:32
select * from #temp1 where importdate >= '2010-06-27' and importdate < '2010-07-08'


N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-07-07 : 05:07:36
Also use unambiguous date formats
http://beyondrelational.com/blogs/madhivanan/archive/2010/06/03/understanding-datetime-column-part-ii.aspx

Madhivanan

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

sachingovekar
Posting Yak Master

101 Posts

Posted - 2010-07-07 : 05:30:34
Thanks madhivanan and peso
Go to Top of Page
   

- Advertisement -