两个数据库:expt,exptmng
两个数据库的表结构一模一样,就是数据可能有些不同,expt为exptmng早一些的数据备份文件,现在我把exptmng一个表test_inf的数据有些改动,修改错了,我现在想把备份文件的数据导回来。就test_inf表的一个字段col_csjg
改回来!
表test_inf的主键为:col_htbh+col_cpbh
数据库exptmng的表test_inf的数据有所增加的。
如何恢复过来?

解决方案 »

  1.   

    --??
    update A
    set A.col_csjg=B.col_csjg
    from  exptmng.dbo.test_inf A ,expt.dbo.test_inf B
    where A.col_htbh=B.col_htbh  and A.col_cpbg=B.col_cpbh
      

  2.   

    update A set A.col_csjg=B.col_csjg
    from exptmng.dbo.test_inf as A, expt.dbo.test_inf as B
    where A.col_htbh=B.col_htbh and A.col_cpbh=B.col_cpbh
      

  3.   

    尝试--
    先把exptmng里面的test_inf备份一个以防失误
    然后用DTS,选择第三项‘sqlserver数据库之间的复制’,下一界面中可以选择是否覆盖或替换之类的选项,从expt往exptmng里面把test_inf导入进来。
      

  4.   

    update A
    set A.col_csjg=B.col_csjg
    from A inner join B on A.col_csjg=B.col_csjg and A.col_cpbh=B.col_cpbh