CREATE PROCEDURE mysp_test
@a int,
@b int,
@c int,
@d int,
@e int
AS
if @a=0 and @b=0
begin
SELECT *
FROM tablename WHERE col_c= @c and col_d=@d and col_e=@e
end
else
begin
if @a=0
select * from tablename where col_b=@b and col_c= @c and col_d=@d and col_e=@e
end
create procedure lfy
@a int=0,@b int=0,@c int=0,@d int=0,@e int=0,
@a1 int output,
@b1 int output,
@c1 int output,
@d1 int output,
@e1 int output
as
begin
if @a=0
begin
select @a1=99999
select @b1=2
select @c1=3
select @d1=4
select @e1=5
end
if @a=0 and @b=0
begin
select @a1=99999
select @b1=99999
select @c1=3
select @d1=4
select @e1=5
end
--下面依次真写就行了,不过这样的条件是有问题的,这个要求最好在调用过程时加上