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
 Transact-SQL (2000)
 Find records where date is between dates

Author  Topic 

uxphreak
Starting Member

38 Posts

Posted - 2005-01-06 : 16:23:45
Hello,

I'm trying to create a query (with little success) that allows me to find records where the date I supply is on or between my StartDate and EndDate columns.

Thanks,

D

X002548
Not Just a Number

15586 Posts

Posted - 2005-01-06 : 16:32:50
Want to post some DDL and sample data? And what sample DML you've tried already.

But off the cuff

WHERE StartDate > @suppliedDate AND EndDate < = @SuppliedDate

Inclusive Exclusive, a mixture of both?



Brett

8-)
Go to Top of Page

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2005-01-06 : 16:43:40
uxphreak,

Be aware that the datetime data type always includes the time portion. If your starting "date" was actually today at noon, the WHERE clause will quite rightly not return rows from this morning.

HTH

=================================================================

A faith that cannot survive collision with the truth is not worth many regrets. -Arthur C Clarke, science fiction writer (1917- )
Go to Top of Page
   

- Advertisement -