追加 insert into table1  select *from table2 覆盖 delete form table1  
再    insert into table1  select *from table2

解决方案 »

  1.   

    覆盖:
    ++++++++=
    Dim cn As New ADODB.Connection
    Dim rs As New ADODB.Recordset
    dim cm as new adodb.command
        If cn.State = adStateOpen Then
        cn.Close
        End If
        cn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=表1;Data Source=" & 数据源
        cn.Open    cn1.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=表2;Data Source=" & 数据源
        cn1.Open    cm.ActiveConnection = cn1
    cm.commandtext="delete from 表2"
    cm.execute
    rs.open "select * from 表1",cn,3,1
    if rs.recordcount<>0 then
    for i=0 to rs.recordcount-1
          cmd=rs.fields(0)
        for j=1 to rs.fields.count-1
             cmd=cmd & "','" & rs.fields(j)
        next j
    cm.commandtext="insert into 表2 values('" & cmd & "')"
    rs.movenext
    next
    end if
      

  2.   

    漏了一句话
    +++++++++++
    cm.execute
      

  3.   

    数据库-如何复制整个表,或把一个表的若干记录添加到另一个表,如何实现,
    SQL语句也可以。数据库对象模型也可以,高手请指点。。
    http://www.csdn.net/expert/topic/626/626404.xml?temp=.7429621
    ----------------------------------------------------------------------
    1)Access 
    ============
    db2.Execute "select * into table2 from c:\db1.table1"   '把整个表复制过去。
    db2.Execute "Insert Into table2(fld2) values (fld1)    '插入数据2) SQL Server 
    =============
    Select * Into database2.dbo.table2 From database1.dbo.table1 Where 1 = 2;
    --但是先得保證database2的select into的dboption必須是true;
    否則就要
    sp_dboption database2,'Select Into/bulkcopy',true;这里指的是MSSql  server里的用法。database2是数据库名,dbo是用户名,table是表名
      
    3) Oralce
    =============
    Create Table table2 As Select * From table1 Where rownum < 1;
      

  4.   

    楼上的你是"Access"中是用ADO还是DAO啊?
    能不能具体点啊?急啊~~~~~~~~~~~~~~~~~~~
      

  5.   

    no_com(探花)应该可以,也很清楚了,就是麻烦一点。
      

  6.   

    我说的Access中,与 ADO ,DAO 无关。 只与 SQL 语句有关.