Sql Tutorial Class


Sql database rename

Sql server database rename








Change the name of the SQL server database: after creating the database on the SQL server. Sometimes it is necessary to rename the existing database. The user does not want to create a database in each type. It is not a good idea for the user of the sql server. To change the name of the sql server database you can use the sql or tsql command.

It is very easy to change the sql server database name.

Syntax:
          sp_renamedb 'OLD_SQL_SERVER_DATABASE_NAME', 'NEW_SQL_SERVER_DATABASE_NAME'


Example:
                   
               Create Database ItemDetails
               sp_renamedb 'ItemDetails', 'Items'

[Note: The ItemDetails database is created in previous lesson.]

Some particles for sql server database rename:

Create Database KFCHotel  
Create Database MacdonaldItams 


Renaming:


sp_renamedb 'KFCHotel', 'KFC5Star'
sp_renamedb 'MacdonaldItams', 'MacdonaldType'







Sql server database rename in image

sql server database rename by tsql


No comments:

Post a Comment