創(chuàng)建存儲(chǔ)過程:
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
接收輸出參數(shù):
DECLARE @count INT
EXECUTE GetCustomers @count OUTPUT
PRINT @count
2,帶返回值
創(chuàng)建存儲(chǔ)過程:
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 存儲(chǔ)過程調(diào)用存儲(chǔ)過程接收輸出參數(shù)返回值,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
您可能感興趣的文章:- sqlserver2005利用臨時(shí)表和@@RowCount提高分頁查詢存儲(chǔ)過程性能示例分享
- sql server2008調(diào)試存儲(chǔ)過程的完整步驟
- SQLServer2008存儲(chǔ)過程實(shí)現(xiàn)數(shù)據(jù)插入與更新
- SQLServer存儲(chǔ)過程創(chuàng)建和修改的實(shí)現(xiàn)代碼
- 獲取SqlServer存儲(chǔ)過程定義的三種方法
- SqlServer存儲(chǔ)過程實(shí)現(xiàn)及拼接sql的注意點(diǎn)
- 淺析SQL Server的嵌套存儲(chǔ)過程中使用同名的臨時(shí)表怪像