Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rename SQL Azure database?

How can i rename the database in sql Azure?

I have tried Alter database old_name {MODIFY NAME = new_name} but not worked.

Is this feature available in SQL Azure or not?

like image 399
Arun Rana Avatar asked Oct 10 '11 10:10

Arun Rana


People also ask

How do I rename a SQL database?

If you are using SQL Server, you can set the database to single-user mode to close any open connections and prevent other users from connecting while you are changing the database name. In Object Explorer, expand Databases, right-click the database to rename, and then select Rename.

How do I edit an Azure SQL database?

Using SQL Server Management Studio You may need to modify the SELECT statement in the SQL pane to return the rows to be modified. In the Results pane, locate the row to be changed or deleted. To delete the row, right-click the row and select Delete. To change data in one or more columns, modify the data in the column.


2 Answers

Just so people don't have to search through the comments to find this... Use:

ALTER DATABASE [dbname] MODIFY NAME = [newdbname] 

(Make sure you include the square brackets around both database names.)

like image 164
Brett Avatar answered Sep 29 '22 01:09

Brett


Please check that you've connected to master database and you not trying to rename system database.

Please find more info here: https://msdn.microsoft.com/en-US/library/ms345378.aspx

like image 31
dimko1 Avatar answered Sep 29 '22 01:09

dimko1