存储过程返回记录总为空,如果修改:
CREATE PROCEDURE txl_list_user
(
@userid int,
@groupid int,
@StartNum int,
@LeaveNum int,
@prevtype int,
@keyword varchar
)
AS
declare @StrSql varchar(1000)
if @prevtype=0
begin
set @StrSql="select id,realname from (select top "+str(@StartNum)+" id,realname from txl_userinfo where userid="+str(@userid)+" and groupid="+str(@groupid)+" and status=0 order by id desc) a where a.id not in (select top "+str(@LeaveNum)+" ID from txl_userinfo where userid="+str(@userid)+" and groupid="+str(@groupid)+" and status=0 order by id desc)"
end
if @prevtype=1
begin
set @strSql="select id,realname from (select top "+str(@StartNum)+" id,realname from txl_userinfo where userid="+str(@userid)+" and groupid="+str(@groupid)+" and (charindex('+@keyword+',realname)>0 or charindex('+@keyword+',pinyin)>0) and status=0 order by id desc) a where a.id not in (select top "+str(@LeaveNum)+" ID from txl_userinfo where userid="+str(@userid)+" and groupid="+str(@groupid)+" and (charindex('+@keyword+',realname)>0 or charindex('+@keyword+',pinyin)>0) and status=0 order by id desc)"
end
exec(@strSql)
GO