求一个存储过程,附带两个小问题
现有一个表有15000条记录 
 TABLE(A,B) 
 1,我要每隔300个记录对接下来的100个记录,更新其中的一个字段内容,写一个存储过程:   例如要更新表中第400到500条记录,再更新第800到900条记录的内容...   
 2,我如何取出表中如:400到500条的记录   
 3,我对该表的A字段排了序,加入到一个新表中,为什么新表记录没有按A字段排序 
 select   *   into   table2   from   table   order   by   a   desc 
 如何才能让表中的字段自动按A字段排序 
------解决方案--------------------1、 
 如果表中没有排序字段,借助临时表,或者游标遍历   
 2、 
 select identity(int,1,1) as rid,* into # from table1 
 select * from # where rid between 401 and 500   
 3、 
 select * into table2 from (select top 100 percnet * from table1 order by a desc) t 
------解决方案--------------------1.假设id为主键 
 create procedure protest 
 begin_num int, 
 end_num int 
 as  
 update tablea set col1= 'value ' where id between begin_num and end_num 
 2.select top 500 * from table where id not in (select top 400 id from table) 
 3.create table test(id int,col1 varchar(10).....) 
 insert into test select * from table order by a desc
------解决方案----------------------2,我如何取出表中如:400到500条的记录   
 SELECT TOP 100 * FROM 你的表名(nolock)   
 WHERE 主鍵字段> (SELECT MAX(主鍵字段) FROM (SELECT TOP 400 
  主鍵字段 FROM 你的表名 ORDER BY 主鍵字段 ASC) AS tmptable) 
  ORDER BY 主鍵字段 ASC
------解决方案--------------------select top 100 * from table where id not in (select top 399 id from table)
------解决方案--------------------SELECT TOP 100 * FROM 你的表名(nolock)   
 WHERE 主鍵字段> (SELECT MAX(主鍵字段) FROM 你的表 WHERE 主键字段 IN (SELECT TOP 400 
  主鍵字段 FROM 你的表名 ORDER BY 主鍵字段 ASC) AS tmptable) 
  ORDER BY 主鍵字段 ASC 
 这样才行吧?