当前位置: 移动技术网 > IT编程>数据库>MSSQL > Sql Server 存储过程调用存储过程接收输出参数返回值

Sql Server 存储过程调用存储过程接收输出参数返回值

2017年09月07日  | 移动技术网IT编程  | 我要评论

夕字五笔怎么打,联通手机充值卡批发,fiinal

创建存储过程:

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 存储过程调用存储过程接收输出参数返回值,希望对大家有所帮助

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网