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-12-05 : 09:07:38
|
Hello all,I have a table - PlantHistory - with 2 datetime fields, like: PlantStartDate - PlantEndDate2000-01-01 00:00:00 2099-12-31 23:59:592002-01-01 00:00:00 2009-12-31 23:59:59...Then I have stored procedure that has 2 datetime parameters, RefStartDate - RefEndDate. Now I have to extract from PlantHistory table only the record that has at least one secondof the fields PlantStartDate and PlantEndDate"inside" my RefStartDate and RefEndDate parameters. How can I write this WHERE clause? Luigi |
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-12-05 : 09:23:31
|
[code]WHERE PlantStartDate < @RefEndDate AND PlantEndDate > @RefStartDate[/code] |
|
|
Ciupaz
Posting Yak Master
232 Posts |
Posted - 2012-12-05 : 09:48:31
|
Thank you very much again Sunitabeck :-)Luigi |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-12-05 : 10:00:13
|
My pleasure :-) |
|
|
|
|
|