Sql Server 存储过程调用存储过程接收输出参数返回值
时间:2021-01-05 13:46:29|栏目:MsSql|点击: 次
创建存储过程:
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
接收输出参数:
DECLARE @count INT EXECUTE GetCustomers @count OUTPUT PRINT @count
2,带返回值
创建存储过程:
ALTER PROCEDURE [dbo].[GetCustomers] AS SELECT [CustomerID] ,[CompanyName] ,[ContactName] ,[ContactTitle] ,[Address] ,[City] ,[Region] ,[PostalCode] ,[Country] ,[Phone] ,[Fax] FROM [Northwind].[dbo].[Customers] RETURN @@rowcount
接收返回值:
DECLARE @count INT EXECUTE @count=GetCustomers PRINT @count