28,391
社区成员
发帖
与我相关
我的任务
分享
存储过程:CREATE procedure NS_GetPaged
(@startIndex int,@endIndex int,@opt varchar(256))
as
set nocount on
exec('declare @indextable table(id int identity(1,1),nid int) set rowcount '+@endIndex+'
insert into @indextable(nid) select B.NcID from pH_Person_Base B inner join pH_Person_Info I on B.NcID=I.NcID where '+@opt+' order by B.regdate desc
select B.perid,B.LastUpdate_Time,B.username,B.regdate,B.flag,B.Nc_best_flag,I.realName,I.sex,I.Age,I.edus,I.personPhone,I.workwill1,I.topall,I.photourl,I.appraise,I.Works,I.AreaWill1,I.AreaWill2,I.AreaWill3,I.WorkWillClass1,I.WorkWillClass2,I.WorkWillClass3 from pH_Person_Base B inner join @indextable t on B.NcID=t.nid inner join pH_Person_Info I on B.NcID=I.NcID
where (t.id between '+@startIndex+' and '+@endIndex+') order by B.LastUpdate_Time desc')
set nocount off
RETURN
GO
调用方法:sql="exec NS_GetPaged "&Thepage&","&nextnum&","""&SearchChar&""""
错误:开头的 标识符 太长。最大长度为 128。
程序要完成的功能是一个多条件选择的查询,查询条件通过用户自己选择,组合查询语句,调用存储过程,显示结果