1
2
3
4
5 CREATE PROCEDURE uspFindProductByModel (
6 @model_year SMALLINT,
7 @product_count INT OUTPUT
8) AS
9BEGIN
10 SELECT
11 product_name,
12 list_price
13 FROM
14 production.products
15 WHERE
16 model_year = @model_year;
17
18 SELECT @product_count = @@ROWCOUNT;
19END;
20
1CREATE PROCEDURE [dbo].[test_Procedure]
2 @input VARCHAR(10),
3 @output VARCHAR(20) output
4AS
5 BEGIN
6 IF @input >= 1
7 BEGIN
8 SET @output = 'Result is from procedure';
9 RETURN;
10 END
11 END
12
13DECLARE @get VARCHAR(20);
14
15EXEC test_Procedure 1, @get output
16SELECT @get
1Copy CodeCREATE PROCEDURE spGetEmployeeCountByGender
2@Gender nvarchar(20),
3@EmployeeCount int Output
4AS
5BEGIN
6SELECT @EmployeeCount = COUNT(Id)
7FROM tblEmployee
8WHERE Gender = @Gender
9END