怎样用select 实现查询出指定范围的数据
我的意思是: 
 通过存储过程实现,穿两个参数StartRecordIndex,PageSize过去,就 
 查询出StartRecordIndex至PageSize的纪录。 
 例如,在customer表中,StartRecordIndex=10,PageSize=10 
 运行这个select语句就可以查出cutomer中第10条到,第19条的纪录!   
 这样的select语句要怎么写?
------解决方案--------------------create  procedure usp_getdata(@StartRecordIndex int ,@pagesize int) 
 as  
 begin 
 declare @sql varchar(8000) 
 select @sql=isnull(@sql, ' ')+ 'select top   '+cast(@pagesize as varchar(20))+  ' * from customer where id not in(select top  '+cast(@StartRecordIndex-1 as varchar(20))+  'id from customer) '  	 
 exec(@sql)   
 end 
------解决方案--------------------create proc search_data 
 ( 
  @StartRecordIndex int , 
  @pagesize int 
 ) 
 as  
 set nocount on 
 declare @sql varchar(1000) 
 set @sql= ' ' 
 select @sql=@sql+ 'select top   '+cast(@pagesize as varchar(20))+  ' * from customer where id not in(select top  '+cast(@StartRecordIndex-1 as varchar(20))+  'id from customer) '  	 
 exec(@sql) 
 set nocount off   
 end