我有这个存储过程
ALTER PROCEDURE [dbo].[usp_mySP]
-- Add the parameters for the stored procedure here
-- For inventory table check.
@DealerID VARCHAR(50),
@Certified VARCHAR(50) = NULL,
-- For fuel value.
@CityFeatureValue VARCHAR(50),
@HwyFeatureValue VARCHAR(50)
AS
BEGIN
BEGIN
SELECT InventoryID,
VIN
FROM Inventory
WHERE DealerID = @DealerID
AND Deleted = 'False'
AND (IsPending = '0' OR IsPending IS NULL)
--AND (Certified = @Certified OR @Certified IS NULL)
AND VIN IN
(
SELECT VIN
FROM FuelPerformance
WHERE (
FeatureTitle = 'Fuel Economy (City)'
AND FeatureValue = @CityFeatureValue
)
OR
(
FeatureTitle = 'Fuel Economy (Hwy)'
AND FeatureValue = @HwyFeatureValue
)
GROUP BY VIN
HAVING COUNT(VIN) > 1
)
END
END
我这样称呼它:
EXEC usp_ListOfVehiclesOnFuelCondition_ForSingleDealer
'09f5245d' , '', '18', '28'
当我评论该行时
AND (Certified = @Certified OR @Certified IS NULL)
它给出了结果,但是当这条线在那里时,结果是空白的。
有什么建议我做错了吗?