Unsupported Screen Size: The viewport size is too small for the theme to render properly.

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: Howto Rename Database… #20548
    elizas
    Member

    A lot of times we need a change . While working on an existing database, we may need to change the database name and in some cases want to rename existing database objects. This can be done in a few seconds.

    In SQL Server this can be done in this manner :

    1. Renaming a database :

    The SQL Server command for renaming a database is :

    Syntax: EXEC sp_renamedb 'oldName', 'newName' ;

    eg: Suppose we have a database named “GPSTrainees” and we want to rename it to “KLMSTrainees”

    We can write :

    EXEC sp_renamedb 'GPSTrainees' , 'KLMSTrainees' ;

    However, though this command works on SQL Server 2000 and SQL Server 2005, it will not be supported in future versions of SQL Server. The new command that should be used for SQL Server 2005 and beyond is:

    ALTER DATABASE oldName MODIFY NAME = newName ;

    eg: ALTER DATABASE GPSTrainees MODIFY NAME=KLMSTrainees

    Eliza

Viewing 1 post (of 1 total)