Thursday, December 17, 2009

Search a date range using a date range in sql

select count(*) from tablename where (@startDate between startDate and endDate )

or (@endDate between startDate and endDate)

or (@startDate <> endDate )


If this sql returns greater than 0, that means there exists a conflict with your date interval and the db working set.