stored procedure example in sql server 2014
Example 1: sql server stored procedure
CREATE PROCEDURE spGetEmployeeCountByGender
@Gender nvarchar(20),
@EmployeeCount int Output
AS
BEGIN
SELECT @EmployeeCount = COUNT(Id)
FROM tblEmployee
WHERE Gender = @Gender
END
Example 2: create select stored procedure in sql server
CREATE PROCEDURE sp_getRaces
AS
BEGIN
SELECT * FROM dbo.Races
END ;