--提取表中第几条到第几条记录 create proc pageSelectTest ( @intN int, @intM int ) as set nocount on declare @intRowCount int declare @strSql nvarchar(200) set @intRowCount=@intM-@intN+1select identity(int,0,1) as id,表名.* into #temp from 表名set @strSql='select top '+cast(@intRowCount as nvarchar(10))+' *from #temp' + ' where id not in ( select top '+ cast((@intN-1) as nvarchar(10)) +' id from #temp)'exec sp_ExecuteSql @strSql go
select top 20 * from tablName where 字段名 not in(select top 10 字段名 From tableName)
我用了REVISION的方法.但不行.我是想从一个表中查几条如:编码是100001_________10055的启纪录..但不行.select top 100001 * from t_goots where itemno=not in(select top 100055 itemno tablename) t_gootsj 是表名...itemno是列名 这样是不是错了..我很菜的
select top 20 * from tablName where 字段名 not in(select top 10 字段名 From tableName)
--提取表中第几条到第几条记录
create proc pageSelectTest
(
@intN int,
@intM int
)
as
set nocount on
declare @intRowCount int
declare @strSql nvarchar(200)
set @intRowCount=@intM-@intN+1select identity(int,0,1) as id,表名.* into #temp from 表名set @strSql='select top '+cast(@intRowCount as nvarchar(10))+' *from #temp' +
' where id not in ( select top '+ cast((@intN-1) as nvarchar(10)) +' id from #temp)'exec sp_ExecuteSql @strSql
go