--try
CREATE procedure UserInfoPage
(
@pagesize int,
@pageindex int,
@docount bit,
@StrWhere varchar(800)
)                                          --加一查寻条件变量
as
set nocount on
if(@docount=1)
select count(User_ID) from UserInfo 
else
begin
create table #indextable(id int identity(1,1),nid int)                     --表变量
declare @PageLowerBound int
declare @PageUpperBound int
set @PageLowerBound=(@pageindex-1)*@pagesize
set @PageUpperBound=@PageLowerBound+@pagesize
set rowcount @PageUpperBound
--当改为insert into @indextable(nid) select User_ID from UserInfo where @StrWhere 时报语法错误   
  declare @SqlStr varchar(1000)                    --加一变量
set @SqlStr='insert into #indextable(nid) select User_ID from UserInfo where '+@StrWhere   --时报 少 +@indextable变量
select O.User_ID from UserInfo O,#indextable t where O.User_ID=t.nid
and t.id>@PageLowerBound and t.id<=@PageUpperBound order by t.id
end
set nocount off
GO