jebushatescats
IS-IT--Management
Hello all
I have the following stored procedure
ALTER PROCEDURE dbo.hrld_sel_business_units
(@PROCESS_LEVEL_LOW varchar(5) = null,
@PROCESS_LEVEL_HIGH varchar(5)= null)
AS
SELECT
'0' as 'PROCESS_LEVEL',
'<All>' as 'NAME'
UNION
SELECT
p.PROCESS_LEVEL,
p.NAME
FROM
DBLAWTS1..PRSYSTEM p
WHERE
p.PROCESS_LEVEL NOT IN ('010', '011', '012') and
p.PROCESS_LEVEL >= @PROCESS_LEVEL_LOW and
p.PROCESS_LEVEL <= @PROCESS_LEVEL_HIGH
ORDER BY
P.NAME
I want to be able to put a conditon on the
'<All>' as 'NAME' statement
so that Name is only assigned the value all
when @PROCESS_LEVEL_LOW = @PROCESS_LEVEL_HIGH
Something like this
ALTER PROCEDURE dbo.hrld_sel_business_units
(@PROCESS_LEVEL_LOW varchar(5) = null,
@PROCESS_LEVEL_HIGH varchar(5)= null)
AS
SELECT
'0' as 'PROCESS_LEVEL',
IF @PROCESS_LEVEL_LOW = @PROCESS_LEVEL_HIGH
'<All>' as 'NAME'
END
UNION
SELECT
p.PROCESS_LEVEL,
p.NAME
FROM
DBLAWTS1..PRSYSTEM p
WHERE
p.PROCESS_LEVEL NOT IN ('010', '011', '012') and
p.PROCESS_LEVEL >= @PROCESS_LEVEL_LOW and
p.PROCESS_LEVEL <= @PROCESS_LEVEL_HIGH
ORDER BY
P.NAME
I have the following stored procedure
ALTER PROCEDURE dbo.hrld_sel_business_units
(@PROCESS_LEVEL_LOW varchar(5) = null,
@PROCESS_LEVEL_HIGH varchar(5)= null)
AS
SELECT
'0' as 'PROCESS_LEVEL',
'<All>' as 'NAME'
UNION
SELECT
p.PROCESS_LEVEL,
p.NAME
FROM
DBLAWTS1..PRSYSTEM p
WHERE
p.PROCESS_LEVEL NOT IN ('010', '011', '012') and
p.PROCESS_LEVEL >= @PROCESS_LEVEL_LOW and
p.PROCESS_LEVEL <= @PROCESS_LEVEL_HIGH
ORDER BY
P.NAME
I want to be able to put a conditon on the
'<All>' as 'NAME' statement
so that Name is only assigned the value all
when @PROCESS_LEVEL_LOW = @PROCESS_LEVEL_HIGH
Something like this
ALTER PROCEDURE dbo.hrld_sel_business_units
(@PROCESS_LEVEL_LOW varchar(5) = null,
@PROCESS_LEVEL_HIGH varchar(5)= null)
AS
SELECT
'0' as 'PROCESS_LEVEL',
IF @PROCESS_LEVEL_LOW = @PROCESS_LEVEL_HIGH
'<All>' as 'NAME'
END
UNION
SELECT
p.PROCESS_LEVEL,
p.NAME
FROM
DBLAWTS1..PRSYSTEM p
WHERE
p.PROCESS_LEVEL NOT IN ('010', '011', '012') and
p.PROCESS_LEVEL >= @PROCESS_LEVEL_LOW and
p.PROCESS_LEVEL <= @PROCESS_LEVEL_HIGH
ORDER BY
P.NAME