从account表查询20000条记录并更新这20000条记记录的result字段改为1。
还有可能有20万的记录同时这样操作,效率尽量高些。

解决方案 »

  1.   

    select top 20000 * from account
    UPDATE TOP (20000) account set result=1
      

  2.   

    select top 20000 这里把除result之外的列列出来,1 as result from accoun
      

  3.   


    --更新前
    select *  from account  where id between 1 and 20000
    --更新
    update account set result=1 where id between 1 and 20000
    --更新后
    select * from account where result=1
      

  4.   

    create proc P_update
    as
    begin
    select top 20000 * from account
    UPDATE TOP (20000) account set result=1
    end那就存储过程
      

  5.   

    只能select 跟update分开写。也可以写个过程什么的,不过你这需求没必要吧?就两句话