Copying databases from one server to the other has become the easiest with SQL Azure. Now you can copy the database simply using the CREATE DATABASE statement in SQL Azure.
CREATE DATABASE command using AS COPY OF in SQL Azure creates a snapshot of the source database as of the time of the copy request. You can select the same server or a different server, its service tier and compute size, or a different compute size within the same service tier (edition). After the copy is complete, it becomes a fully functional, independent database. At this point, you can upgrade or downgrade it to any edition. The logins, users, and permissions can be managed independently.
To create a copy of SQLCOMMUNITY database from production server instance called SOURCESQLSERVER to the local server instance as SQLCOMMUNITY_DBCOPY
Syntax:
Create Database <new_database_name> As Copy Of <source_sql_server_name>.<source_database_name>
<new_database_name> = This is the name of the database you will create a copy from the source database
<source_sql_server_name> = This is the name of the source SQL Azure database instance name from where the database will be copied
<source_database_name> = This is the name of the actual database that you want to make a copy from
Example:
CREATE DATABASE [SQLCOMMUNITY_DBCOPY] AS COPY OF [SOURCESQLSERVER].[SQLCOMMUNITY];
Note: Always run the above statement from the destination server and make sure that the user is logged in using the same account as Source database instance and has permissions to create a database.
Recent Comments