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.
Author |
Topic |
Ciupaz
Posting Yak Master
232 Posts |
Posted - 2012-10-08 : 03:51:06
|
Hello all,I have a table (SQL Server 2008 R2) with 2 datetime fields, like: StartDate - EndDateNow I have a query with 2 variables, Date1 and Date2. How can I know if there is an overlapping between these dates? For example I have to check if the range between Date1 and Date2 is inside (also for one second) between StartDate and EndDate in the table. How can I accomplish this? Thank you. Luigi |
|
stepson
Aged Yak Warrior
545 Posts |
Posted - 2012-10-08 : 04:48:55
|
where @data1>StartDateand @data1<EndDateand @data2>StartDateand @data2<EndDate |
|
|
Ciupaz
Posting Yak Master
232 Posts |
Posted - 2012-10-08 : 10:02:04
|
Thanks very much Stepson.Luigi |
|
|
|
|
|