永发信息网

SQL中存储过程调用存储过程,怎么取返回值

答案:2  悬赏:30  手机版
解决时间 2021-03-04 20:13
  • 提问者网友:遁入空寂
  • 2021-03-04 09:22
SQL中存储过程调用存储过程,怎么取返回值
最佳答案
  • 五星知识达人网友:拾荒鲤
  • 2021-03-04 10:02
存储过程中的第一个参数 @title 将接收由调用程序指定的输入值,而第二个参数 @ytd_sales 将向调用程序返回该值。SELECt 语句使用 @title 参数以获得正确的 ytd_sales 值,并将该值赋予 @ytd_sales 输出参数。
CREATE PROCEDURE get_sales_for_title
@title varchar(80), -- This is the input parameter.
@ytd_sales int OUTPUT -- This is the output parameter.
AS
-- Get the sales for the specified title and
-- assign it to the output parameter.
SELECT @ytd_sales = ytd_sales
FROM titles
WHERe title = @title
RETURN
GO
全部回答
  • 1楼网友:刀戟声无边
  • 2021-03-04 11:27
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
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯