insert B(字段列表) select 对应的字段列表 from A
delete B

解决方案 »

  1.   

    --写成存储过程
    create proc p_process
    as
    set xact_abort on
    begin tran
    insert B(字段列表) select 对应的字段列表 from A
    delete B
    commit tran
      

  2.   

    insert B(字段列表) select 对应的字段列表 from A
    truncate table  B
      

  3.   

    --写成存储过程
    create proc p_process
    as
    set xact_abort on
    begin tran
    insert B(字段列表) select 对应的字段列表 from A
    delete A
    commit tran
      

  4.   

    在 zjcxc(邹建) 大哥上改一下:--写成存储过程
    create proc p_process
    as
    set xact_abort on
    begin tran
    insert B(字段列表) select 对应的字段列表 from A
    TRUNCATE TABLE A表
    commit tran
      

  5.   

    不好意思,最后是删除A表中插入B表的那些记录,不是把A表都删除,该怎么做啊,小弟新手,谢谢!!
      

  6.   

    --写成存储过程
    create proc p_process
    as
    set xact_abort on
    begin tran
    insert B(字段列表) select 对应的字段列表 from A where 条件
    delete from A where 条件
    commit tran
      

  7.   

    --写成存储过程
    create proc p_process
    as
    set xact_abort on
    begin tran
    insert B(字段列表) select 对应的字段列表 from A where 条件
    delete B where 条件
    commit tran
      

  8.   

    create proc p_process
    as
    set xact_abort on
    begin tran
    insert B(字段列表) select 对应的字段列表 from A where 条件
    delete from A where 条件
    commit tran
      

  9.   

    各位大哥,那如果要在插入同时,把B表中那个不同的字段写入插入时间的话该怎么写呢?是不是可以这样:
    create proc p_process
    as
    set xact_abort on
    begin tran
    insert B(字段列表,新的字段=@变量) select 对应的字段列表 from A where 条件
    delete from A where 条件
    commit tran
      

  10.   

    insert B(字段列表,新的字段) select 对应的字段列表,@变量 from A where 条件
      

  11.   

    谢谢,结帐,lsxaa(小李铅笔刀)!:)
      

  12.   

    create proc p_process
    as
    set xact_abort on
    begin tran
    insert B(字段列表,新的字段) select 对应的字段列表,@变量 from A where 条件
    delete from A where 条件
    commit tran