我想请问各位大虾,在Delphi6中如何能将SQL数据库中的若干个表(不是全部)备份呢?
因为一般的备份整个数据库可以办到,而只备份几个表就不知如何是好了,请大家多多指教!!

解决方案 »

  1.   

    use master:
      restore database 数据库名 from disk='c:\x.bak' with init
      backup  database 数据库名 disk='c:\x.bak' with replace
      

  2.   

    我写过用ADO表的非常容易的过程:)TADOTABLE.SaveToFile就可以了,这个过程原型如下procedure SaveToFile(const FileName: String = ''; Format: TPersistFormat = pfADTG);如要把表tb_mytable保存到C:\backup下
    procedure savetb;
    var
      tb_mytable: TADOTABLE;
    begin
      tb_mytable:=TADOTABLE.create(nil);
      try
        tb_mytable.connection:=//你的ADO连接
        tb_mytable.tablename:='tb_mytable';
        tb_mytable.open;
        tb_mytable.savetofile('c:\backup');
      finally
        tb_mytable.free;
      end;
    end;很容易的:)