create proc proc_name (@row int ,@num int) as
select * from (select top @row+@num from table) a where id not in(select top @row id from table)exec proc_name 10,20返回从10开始的20条记录
select * from (select top @row+@num from table) a where id not in(select top @row id from table)exec proc_name 10,20返回从10开始的20条记录
解决方案 »
- SQL Server如何运行.SQL文件
- 数据库维护计划可以导出成SQL脚本吗?
- 求一触发器,在线等!!!
- 一个超级难,超级纠结的查询,求高高高高手来搞定
- SQL Server在存储(或触发)中连接远程SqlServer
- sql数据库优化?
- 关于用SQL语句修复数据库慢的问题
- 数据库突然SUSPECT了,我不知该如何恢复
- 关于得到20902汉字的问题,明天结帐!
- 用transact_sql来进行数据库的建立和恢复,但是恢复以后在企业管理器中显示“正在加载”,这是什么原因?
- ***在存储过程里,用两个游标作一个嵌套循环,然后插入一个临时表里,最后查询的实现问题,请指教一二,谢谢!!***
- sql2000的怪问题?
as
select *,identity(int,1,1) as id into #ttt from @sql a
select top @row+@num from #ttt a where id >=@row