Refering to the scenario described on my previous post:
In a T-SQL script I have the initialization code:
declare @DeviceID int
declare @Partition int
set @DeviceID = 4000
set @Partition = 4000 % 250
And, if I try the following query, I get partition elimination:
select COUNT(*)
from Devices
where DeviceID = @DeviceID
and Date_Time >= '2010-02-01' and Date_Time < '2010-03-01'
and Partition = 0
But, if I try the following, I don't get partition elimination:
select COUNT(*)
from Devices
where DeviceID = @DeviceID
and Date_Time >= '2010-02-01' and Date_Time < '2010-03-01'
and Partition = @Partition
How am I going to be able to build a stored procedure if I need to explicitly set the partiton value this way?