How to rename a SQL Azure database?


Can we rename a database in SQL Azure? Absolutely! In blog post, we will see how we can do that?

First, few things to note:

1. You need to connect to Master Database.

2. And you can rename only user databases. That means the master database cannot be renamed.

3. And the Alter database (which is the TSQL statement to rename database) should be the only statement in the batch.

Now, Here is the query:


alter database <old-database-name>

modify name =<new-database-name>

Here is the screenshot when I tried to rename the database name by login with the principal server login into the Master Database:

rename database SQL Azure

So that’s it – you can rename the database in SQL Azure.

0 thoughts on “How to rename a SQL Azure database?

What do you think? Leave a comment below.