Sql Server中存储过程中输入和输出参数(简单实例 一看就懂)
程序员文章站
2023-12-12 22:06:58
[sql] -- ===================【创建存储过程】===================== use [message] go /****** obj...
[sql]
-- ===================【创建存储过程】=====================
use [message]
go
/****** object: storedprocedure [dbo].[读取外部数据库查询] script date: 10/24/2012 05:39:16 ******/
set ansi_nulls on
go
set quoted_identifier on
go
-- ============================================= \\ working没有变1,错误码没有测试,计划时间测试,企业名称
create procedure [dbo].[数据库查询]
@smscontent varchar(20)='1231', -- 输入参数
@bj1 int out -- 输入出参数
as
begin
select @bj1=count(id) from sss
end
-- ===============【调用】==================
use [message]
declare @return_value int
exec [dbo].[数据库查询] '1231',@return_value output
select @return_value
-- ===================【创建存储过程】=====================
use [message]
go
/****** object: storedprocedure [dbo].[读取外部数据库查询] script date: 10/24/2012 05:39:16 ******/
set ansi_nulls on
go
set quoted_identifier on
go
-- ============================================= \\ working没有变1,错误码没有测试,计划时间测试,企业名称
create procedure [dbo].[数据库查询]
@smscontent varchar(20)='1231', -- 输入参数
@bj1 int out -- 输入出参数
as
begin
select @bj1=count(id) from sss
end
-- ===============【调用】==================
use [message]
declare @return_value int
exec [dbo].[数据库查询] '1231',@return_value output
select @return_value