1)调用无参存储过程
创建存储过程:
create procedure usp
as
select *from Student
调用无参存储过程:
2)调用有参存储过程
创建存储过程:
alter procedure usp
@gender char(1)
as
select *from Student
where Gender=@gender
调用有参存储过程:
3)调用输入和输出参数存储过程
创建存储过程
alter procedure usp
@gender char(1),
@num int output
as
select *from Student
where Gender=@gender
select @num= count(1) fomr Student
where Gender=@gender
return 10
查看存储过程
declare @gender char
set @gender=‘0’
declare @num int
set @num=0
declare @return int
set @return =0
exec @return=usp @gender,@num ouput
print @return
调用输入与输出参数存储过程: