Traitée replacate a db to another

  • 2012年1月18日 18:09
     
     

    Hi All I was looking for some tsql like

    restore database x to database y how do I use the eretore command to nightly copy one DBs content to the other?

全部回复

  • 2012年1月19日 13:48
    答复者
     
     

    Hello,

    It depends on what you mean by "copy".

    Do you want to completely overwrite the y database with the x database so it's an exact copy? Do you just want to update a specific table in y from x? Do they hold different sets of data but one or more tables should be kept in synch?

    -Sean

  • 2012年1月26日 6:54
    版主
     
     已答复
    Hi rmerritt,

    Could you please elaborate on your scenario a bit more?

    To restore a database from a backup file, you can use RESTORE DATABASE command. In case of you are trying to restore an existing database which is in using, you may need to change it to the single user mode and rollback after completing. For more information: SQL SERVER – Restore Database Backup using SQL Script (T-SQL).

    Stephanie Lv

    TechNet Community Support