Friday 22 May 2015

How To return full table when no input parameter is supplied to the Stored Procedure in SQL

create PROCEDURE spg 
@emp_id bigint = NULL
AS
SELECT *
FROM employees
WHERE emp_id = ISNULL(@emp_id,emp_id)
GO

--ISNULL(expression,replacementvalue)
--SELECT * FROM employees WHERE emp_id = emp_id


No comments:

Post a Comment