CREATE PROCEDURE dbo.PPOK_HousePage
(@int_pagenow int=0,
@int_pagesize int=0,
@str_SQLWhere varchar(222),
@int_recordcount int=0 output)AS
set nocount ondeclare @int_allid int
declare @int_beginid int,@int_endid int
declare @int_pagebegin int, @int_pageend int select @int_allid=count(sID) from PPOK_House
select @int_recordcount=@int_allid declare cro_fastread cursor scroll
for
select sID from PPOK_House order by sID desc open cro_fastread
select @int_beginid=(@int_pagenow-1)*@int_pagesize+1
select @int_endid = @int_beginid+@int_pagesize-1 fetch absolute @int_beginid from cro_fastread into @int_pagebegin
if @int_endid>@int_allid
fetch last from cro_fastread into @int_pageend
else
fetch absolute @int_endid from cro_fastread into @int_pageend select * from PPOK_House where sID between @int_pageend and @int_pagebegin
order by sID desc close cro_fastread
deallocate cro_fastread return
GO====================================================我想在最后一句添上 @str_SQLWhere 变量该如何做呢?谢谢了。
即这句: select * from PPOK_House where sID between @int_pageend and @int_pagebegin
order by sID desc
(@int_pagenow int=0,
@int_pagesize int=0,
@str_SQLWhere varchar(222),
@int_recordcount int=0 output)AS
set nocount ondeclare @int_allid int
declare @int_beginid int,@int_endid int
declare @int_pagebegin int, @int_pageend int select @int_allid=count(sID) from PPOK_House
select @int_recordcount=@int_allid declare cro_fastread cursor scroll
for
select sID from PPOK_House order by sID desc open cro_fastread
select @int_beginid=(@int_pagenow-1)*@int_pagesize+1
select @int_endid = @int_beginid+@int_pagesize-1 fetch absolute @int_beginid from cro_fastread into @int_pagebegin
if @int_endid>@int_allid
fetch last from cro_fastread into @int_pageend
else
fetch absolute @int_endid from cro_fastread into @int_pageend select * from PPOK_House where sID between @int_pageend and @int_pagebegin
order by sID desc close cro_fastread
deallocate cro_fastread return
GO====================================================我想在最后一句添上 @str_SQLWhere 变量该如何做呢?谢谢了。
即这句: select * from PPOK_House where sID between @int_pageend and @int_pagebegin
order by sID desc
解决方案 »
- 统计数据
- 求:创建自动生成单据编号的存储过程。
- 查询缺失的数据(高分,在线等!!!)
- 如何知道哪些SQL语法是SqlServer特有的,哪些是一般的数据库(尤其是mysql等小型数据库)也有的?
- sql 出现科学计数法怎么处理? ###########100%结贴
- 子选择的问题
- VS2005连接sql server 2005 express时如何设置sql2005做到 "userID=sa;pwd=;"?
- 请问各位大虾SQL Server2000 DTS导数据的原理是什么?
- 不好意思:DBMS_OUTPUT.PUT_LINE的用法!
- 数据查询为什么少显示两条?
- 如何找出数据库中记录数大于50000的表(在线等待)
- 关于分类统计的问题,盼一语句.
and @str_SQLWhere
order by sID desc
and @str_SQLWhere
order by sID desc====================sql 提示语法错误 在 and 附近
set @sql='select * from PPOK_House where sID between '+ltrim(@int_pageend)+' and '+ltrim(@int_pagebegin)+@str_SQLWhere +' order by sID desc'
exec sq_executesql @sql