I'm new with T-SQL and MSSQL but need to copy Azure SQL database from one server to another.
As I googled here – it can be done with a CREATE DATABASE Database1_copy AS COPY OF server1.Database1;
query, but in my Vusial Studio Code editor on the Ubuntu Linux with the vscode-mssql
extention – I have an error:
Msg 156, Level 15, State 1, Line 1 : Incorrect syntax near the keyword 'database'.
My full query looks next:
CREATE DATABASE Database1_copy AS COPY OF oldserver.database.windows.net.olddatabasenamehere;
Additional googling leads me to the same solutions (here is another example I found).
What I'm doing wrong here?
I understood that even the first link published on Azure's resource (azure.microsoft.com) – it does not necessarily is working solution for Azure's SQL.
P.S. Idea is to automate DEV environment rollout (with ARM templates) as a copy of the current Live environment, with creating databases as a copy of Live's databases.
Best Answer
From BOL :
So your command should be