Hi,
I have stored procedure the is expecting few parameters.
Proj_id Int
Priority Int
type varchar
here is my scenario. Users HAVE to select a project; however, may or may not select a priority.
priority value is a dropdown list (1 or 2 or 3). my problem is if they don't select any value which will pass Null or 0 to the stored procedure I'm not sure how to ignore evaluating the parameter since it's part of my WHERE claus..
here is part of my code:
--------------------------------------------
Begin
SET NOCOUNT ON;
DECLARE @PROJ_ID numeric(10)
DECLARE @PRTY_ID AS NUMERIC (1)
DECLARE @PRTY_ALL AS VARCHAR (8)
SET @PROJ_ID = @PROJ
SET @PRTY_ID = @PRTY
SELECT .......
FROM .........
WHERE
PROJECT_ID = @PROJ_ID
AND PRIORITY = @PRTY_ID ---> if the user deoesn't select a priority value I want to show ALL priorities.
the same condition applies to my Type parameter.
---------------------------------------------
Any suggestion is highly appreciated.
thanks
I have stored procedure the is expecting few parameters.
Proj_id Int
Priority Int
type varchar
here is my scenario. Users HAVE to select a project; however, may or may not select a priority.
priority value is a dropdown list (1 or 2 or 3). my problem is if they don't select any value which will pass Null or 0 to the stored procedure I'm not sure how to ignore evaluating the parameter since it's part of my WHERE claus..
here is part of my code:
--------------------------------------------
Begin
SET NOCOUNT ON;
DECLARE @PROJ_ID numeric(10)
DECLARE @PRTY_ID AS NUMERIC (1)
DECLARE @PRTY_ALL AS VARCHAR (8)
SET @PROJ_ID = @PROJ
SET @PRTY_ID = @PRTY
SELECT .......
FROM .........
WHERE
PROJECT_ID = @PROJ_ID
AND PRIORITY = @PRTY_ID ---> if the user deoesn't select a priority value I want to show ALL priorities.
the same condition applies to my Type parameter.
---------------------------------------------
Any suggestion is highly appreciated.
thanks