试一下fetch ,有时好像可以

解决方案 »

  1.   

    好吧!你试试:
    select top 9 * into #temp1 from tablename
    delete from tablename where id in (select top 9 id from tablename)
    select * into #temp2 from tablename
    go
    TRUNCATE TABLE tablename
    go
    insert into tablename select * from #temp1
    insert into tablename (你插入的行)
    insert into tablename select * from #temp2
      

  2.   

    我觉得帖主是受FOX的影响了,应该摆脱这种以前的思维方式。
      

  3.   

    哈哈,是不是逻辑上显示的效果?如果你的表没有IDENTITY列,你可以这样
    select * into #t from t2 
    alter table #t add id int identity(1,2)
    go
    set identity_insert #t on
    go
    insert  #t(name,num,id) values('before10',30,18)
    truncate table t2
    go
    insert into t2 select name,num from #t order by id
    drop table #t
    go
    select * from t2
    go
    results:
    name       num         
    ---------- ----------- 
    老张人        210
    ok         110
    hi         20
    alove      110
    NULL       NULL
    --         0
    NULL       NULL
    a          80
    a          2
    before10   30
    test       30
    b          10
    alove      110
    ok         90
    b          30(15 row(s) affected)