这种存储过程只能这么写吗?
with adoquery dobegin close; sql.clear; sql.add('select * from hyxx where flag=0'); if a<>0 then sql.add('and jf<>0'); if b<>0 then sql.add('and je<>0'); open;end;
create procedure hycx@a int,@b intas if @a<>0 and @b<>0 select * from hyxx where flag=0 and jf<>0 and je<>0 else if @a<>0 and @b=0 select * from hyxx where flag=0 and jf<>0 else if @a=0 and @b<>0 .....
create procedure hycx@a int,@b intas declare @sql nvarchar(800) set @sql=N'select * from hyxx where 1=1' if @a<>0 and @b<>0 set @sql=@sql+N' and flag=0 and jf<>0 and je<>0' else if @a<>0 and @b=0 set @sql=@sql+N' and flag=0 and jf<>0' else if @a=0 and @b<>0 ..... exec (@sql)