how to execute stored procedure 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: output parameter use with stored procedure
CREATE PROCEDURE uspFindProductByModel (
@model_year SMALLINT,
@product_count INT OUTPUT
) AS
BEGIN
SELECT
product_name,
list_price
FROM
production.products
WHERE
model_year = @model_year;
SELECT @product_count = @@ROWCOUNT;
END;