@sql.monkey
I'm probably missing something here - wouldn't be the first time, but what do you do when your PK and your date column are in a different order? There's no reason why they should be in the same order is there?
PK datecol
1 20070703
2 20070702
3 20070703
4 20070709
5 20070710
6 20070706
7 20070706
8 20070705
select @min-2 = min(primarykey) where datecol >= '20070702'
--@min = 2
select @max-2= max(primarykey) where datecol <= '20070705'
--@max = 8
select primarykey, datecol from table where primarykey between @min-2 and @max-2
So it looks like you end up missing records you do want and including records that you don't want.
Cheers
GPO
...One of the symptoms of an approaching nervous breakdown is the belief that ones work is terribly important.... Bertrand Russell