创建存储过程:
sql;">
ALTER PROCEDURE [dbo].[GetCustomers]
(@rowcount INT OUTPUT)
AS
SELECT [CustomerID],[CompanyName],[ContactName],[ContactTitle],[Address],[City],[Region],[PostalCode],[Country],[Phone],[Fax]
FROM [Northwind].[dbo].[Customers]
SET @rowcount=@@rowcount
接收输出参数:
sql;">
DECLARE @count INT
EXECUTE GetCustomers @count OUTPUT
PRINT @count
2,带返回值
创建存储过程:
sql;">
ALTER PROCEDURE [dbo].[GetCustomers]
AS
SELECT [CustomerID],[Fax]
FROM [Northwind].[dbo].[Customers]
RETURN @@rowcount
接收返回值:
sql;">
DECLARE @count INT
EXECUTE @count=GetCustomers
PRINT @count
以上所述是小编给大家介绍的sql Server 存储过程调用存储过程接收输出参数返回值,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对编程之家网站的支持!