分页的sql语句:
select * from (select ROW_NUMBER() over(order by UserId)as
rownum,* from T_UserInfo) t where rownum>3 and rownum<=6
????//调用分页的存储过程
create proc profenye
@pagesize int,
@pageindex int
as
select * from (select ROW_NUMBER() over(order by UserId)as
rownum,* from T_UserInfo)t where
rownum>(@pageindex-1)*@pagesize
and
rownum<=@pageindex*@pagesize
go
--调用
exec profenye 3,1
索引:
select distinct * into newtable from T_GRDA
--删除原表
delete from T_GRDA WHERE 1=1
--将临时表数据导入到原表中
insert into T_GRDA
SELECT * FROM newtable
//删除临时表
drop table newtable