locked
SQL Azure - COPY and overwrite RRS feed

  • Question

  • Hi,

    I would like to automate my copy/backup of database in SQL Azure. I was wondering if I can overwrite an existing database (my previous copy) with the CREATE DATABASE AS COPY OF statement.

    Thanks,

    Ludo

    Tuesday, March 8, 2011 9:54 PM

Answers

  • Overwriting is not supported in Create Database statement of SQLAzure, just like in SQL Server, you create a db, if you create again the db with same name, you will got the error message of "Database 'test1' already exists. Choose a different database name."

     

    Thanks

    Qiong


    Qiong Wu - MSFT
    • Proposed as answer by Paras Doshi Wednesday, March 9, 2011 11:55 AM
    • Unproposed as answer by Paras Doshi Sunday, March 27, 2011 8:52 AM
    • Marked as answer by Allen Chen - MSFT Monday, March 28, 2011 2:14 AM
    Wednesday, March 9, 2011 6:05 AM

All replies

  • Ludo,

    The db copy in SQL azure is support.

    Start copying the source database with the SQL Azure Database CREATE DATABASE statement. You must be connected to the master database with a login that meets the permission requirements as described in Permissions. To initiate cross-server copying, you must be connected to the master database of the SQL Azure server where the new database will be created: the destination server.

    CREATE DATABASE destination_database_name
        AS COPY OF [source_server_name.]source_database_name

    Executing this statement initiates the database copy process. If source_server_name is not provided, the source database must be located on the same SQL Azure server that your login is connected to. Because this is an asynchronous process, the CREATE DATABASE statement will return before the database completes copying.

    you can find more detail @

    http://msdn.microsoft.com/en-us/library/ff951624.aspx


    Sean Liu
    Wednesday, March 9, 2011 5:48 AM
  • Overwriting is not supported in Create Database statement of SQLAzure, just like in SQL Server, you create a db, if you create again the db with same name, you will got the error message of "Database 'test1' already exists. Choose a different database name."

     

    Thanks

    Qiong


    Qiong Wu - MSFT
    • Proposed as answer by Paras Doshi Wednesday, March 9, 2011 11:55 AM
    • Unproposed as answer by Paras Doshi Sunday, March 27, 2011 8:52 AM
    • Marked as answer by Allen Chen - MSFT Monday, March 28, 2011 2:14 AM
    Wednesday, March 9, 2011 6:05 AM
  • I tried it - it throws an error :

    Database 'DB_Name' already exists. Choose a different database name.

    You came up with an interesting scenario, though!

    why don't you log your feedback on http://www.mygreatwindowsazureidea.com/forums/34685-sql-azure-feature-voting

    ATB,

    Paras

     

    Wednesday, March 9, 2011 11:55 AM