STORE PROCEDURE ADVANCE CONCEPT - PART 2
List All Stored Procedures SELECT name FROM sys.procedures; ================================================================================ Stored Procedure Calling Another Stored Procedure with Parameters in SQL Server You cannot create a stored procedure inside another stored procedure, but you can call one stored procedure from another and pass parameters . Step 1: Create Table CREATE TABLE Employee ( EmpID INT IDENTITY ( 1 , 1 ) PRIMARY KEY , EmpName VARCHAR ( 100 ), Salary DECIMAL ( 10 , 2 ) ); Step 2: Insert Sample Data INSERT INTO Employee(EmpName, Salary) VALUES ( 'Nilesh Gupta' , 50000 ), ( 'Rahul Sharma' , 45000 ), ( 'Priya Patel' , 55000 ); ====================================================================================== Procedure 1: Get Employee by ID CREATE PROCEDURE sp_GetEmployeeByID ( @EmpID INT ) AS BEGIN SELECT * FROM Employee WHERE EmpID = @EmpID; END ; GO Execute EXEC sp_GetEmployeeByI...