創建存儲過程:
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
以上所述是小編給大家介紹的Sql Server 存儲過程調用存儲過程接收輸出參數返回值,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對 網站的支持!