how to create stored procedure in sql server with output parameter code example
Example 1: sql server execute stored procedure with parameters
CREATE PROCEDURE dbo.uspGetAddress @City nvarchar(30) AS
SELECT * FROM Person.Address WHERE City = @City
EXEC dbo.spGetAddress @City = 'Bordeaux'
Example 2: ms sql server stored procedure output parameter
Copy CodeCREATE PROCEDURE spGetEmployeeCountByGender
@Gender nvarchar(20),
@EmployeeCount int Output
AS
BEGIN
SELECT @EmployeeCount = COUNT(Id)
FROM tblEmployee
WHERE Gender = @Gender
END