Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2007

    Unanswered: Restore Backup to second system without overwriting local custom views?

    Is this possible?

    here is the situation. I have a DB on one system. I back it up and then restore it to a second system. This second system I run reports off of and I want to create custom views that do not exist on the original system. Can I restore the
    backup DB from the remote system without wiping out the custom views on the local system?

    I have to do this this way as they won't let us create the views we want on the remote system so the only way we have access to run the reports is by restoring the backup locally.


  2. #2
    Join Date
    Jul 2003
    San Antonio, TX
    You can, but not the way you want it. What you need to do is to have the script that contains CREATE VIEW for all your views. After your restore finishes, you invoke this script against the restored database. If you already have the RESTORE automated, then just add the call to this script as the next step in the job. Look up SQLCMD -i for details on how to run a script from command line.
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  3. #3
    Join Date
    Nov 2007


    Thanks. That looks like a good solution to my problem. Someone else had told me to have a second local DB, that held the views, and link to the restored DB like so:

    CREATE VIEW your_view_1
    SELECT ...
    FROM restored_database.dbo.table_name
    WHERE ...

    I think that keeping it down to one DB will be less of a headache.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts