SQL Backup/ restore using


  • I am currently using this command to backup: ( it works fine)

    backup database dbname to disk='Path'

    and this code for restore: (it also work fine)

     RESTORE DATABASE dbname from disk='path' with replace

    both of these codes just work fine when I use both back-up and restore at the same computer with the same database(with same path also)

    All I want is to ability to restore the back-up to other system which might have db with different name or path.

    in my case when the restore path is not same then also I am not able to restore this to same database.

    for eg if when I take backup of "DBNAme" database its in C:\db\DBNAME but on the other machine this is in D:\db\DBNAME

    and I have to restore it to the same.

    Please help me as this in one of the most important part of my program.

    all I want is that when I restore a backup it will simple restore the data without considering the name of database or path .

    thanks for your help in advance..

    Pradeep Yadav (Social MSDN)

    • Edited by pk.yadav Saturday, August 24, 2013 6:06 AM error
    Saturday, August 24, 2013 6:04 AM