查询插入
当我从SQL2005里查到我想要的内容
想从A1表里插入到A2表里,怎么做
表结构如下:
a1表:
id bellid name pric date
 1  202    aa   2   2008
 2  209    dd   5   2007
a2表:
id bellid name pric date
 1  208    cc   2   2003
 2  206    dd   5   2001我想给A1表里的内容写到A2表里怎么写,是SQL2005数据库
有没有办法,字段是一样的,最多就是字段的顺序不对.有办法从A1导入到A2表里吗

解决方案 »

  1.   

    insert a1(bellid ,name, pric ,date ) Select bellid ,name, pric ,datefrom a2 where ....
      

  2.   

    insert into A2 select 按照A2的顺序 from A1
      

  3.   

    方向弄錯了
    insert a2(bellid ,name, pric ,date ) Select bellid ,name, pric ,date from a1 where ....
      

  4.   

    insert into A2 select 按照A2的顺序 from A1
      

  5.   

    --if a2.id identity
    insert a2
    select bellid,name,pric,date from a1 
      

  6.   


    insert into a2 select * from a1 where ...条件