以下に示すようなストアドプロシージャがあります。私が合格NULL
したとき、Gkol
それを可能な限り最小限の量(テーブルに存在する)に変更したいのですが、それは起こりません-それはなぜですか?
ALTER PROCEDURE sp_vUnitsUnitTejariGetFilteredUnitDetail
(@UnitFB BIT,
@UnitWithCooking BIT,
@MMofidFrom FLOAT = NULL,
@MMofidTo FLOAT = NULL,
@GKolFrom FLOAT = NULL,
@GKolTo FLOAT = NULL)
AS
BEGIN
DECLARE @MMofidCalculative BIT
DECLARE @GKolCalculative BIT
IF (@MMofidFrom IS NULL)
SELECT @MMofidFrom = MIN(MMofid)
FROM vw_PSA_UnitsUnitTejari
IF (@MMofidTo IS NULL)
SELECT @MMofidTo = MAX(MMofid)
FROM vw_PSA_UnitsUnitTejari
IF (@GKolFrom IS NULL)
SELECT @GKolFrom = MIN(GKol)
FROM vw_PSA_UnitsUnitTejari
IF (@GKolTo IS NOT NULL)
SELECT @GKolTo = MAX(GKol)
FROM vw_PSA_UnitsUnitTejari
SELECT *
FROM vw_PSA_UnitsUnitTejari
WHERE UnitTypeID = 1
AND UnitStateID = 1
AND UnitFB = ISNULL(@UnitFB, UnitFB)
AND UnitWithCooking = ISNULL(@UnitWithCooking, UnitWithCooking)
AND MMofid BETWEEN @MMofidFrom AND @MMofidTo
AND GKol BETWEEN @GKolFrom AND @GKolTo
END