Hi,
I am having problem to write parameter in following procedure.
CREATE PROCEDURE Emp_proc
@EmpNoMin varchar(6)
,@EmpNoMax varchar(6)
AS
BEGIN
SET NOCOUNT ON
SELECT
E.EMPNAME
E.DEPARTMENT
FROM EMP_TBL
WHERE
EMPNO between @EmpNoMin and @EmpNoMax
END
The above procedure gives me to enter only range of employee number at a time.
But some times users want to run procedure for all employees by giving keywork 'ALL' OR
they want to enter in Range of employee number
I want to do some thing like this
WHERE
(@EmpNo='ALL') OR
(EMPNO=@EmpNo)
Can you please help me how to incorporate these logic in the proceudre.
Thx
Raj.
I am having problem to write parameter in following procedure.
CREATE PROCEDURE Emp_proc
@EmpNoMin varchar(6)
,@EmpNoMax varchar(6)
AS
BEGIN
SET NOCOUNT ON
SELECT
E.EMPNAME
E.DEPARTMENT
FROM EMP_TBL
WHERE
EMPNO between @EmpNoMin and @EmpNoMax
END
The above procedure gives me to enter only range of employee number at a time.
But some times users want to run procedure for all employees by giving keywork 'ALL' OR
they want to enter in Range of employee number
I want to do some thing like this
WHERE
(@EmpNo='ALL') OR
(EMPNO=@EmpNo)
Can you please help me how to incorporate these logic in the proceudre.
Thx
Raj.