回 帖 发 新 帖 刷新版面

主题:求一带条件的存储过程

if studentnum<>'' then'
 select * from mytable where studentnum like 'studentnum%'
elseif name<>'' then
select * from mytable where name like 'name%'
elseif nj_c<>'' then
select * from mytable where nj_c='nj_c'
end if
在存储过程应如何写,请高手帮忙

回复列表 (共1个回复)

沙发

create procedure test
@studentnum char(50),
@name char(50),
@nj_c char(50)
as
 if @studentnum<>''
   select * from mytable where studentnum like @studentnum +'%'

    

我来回复

您尚未登录,请登录后再回复。点此登录或注册