SQL Server Performance

Alter the Existing Database name

Discussion in 'Getting Started' started by pinky, Jun 8, 2007.

  1. pinky New Member

    Dear Expert's
    How to alter the existing Database Name in sql server .


    Thanks & Regards,
    Pinky[:I]
  2. FrankKalis Moderator

    Check out the ALTER DATABASE syntax in the online manual. [<img src='/community/emoticons/emotion-1.gif' alt=':)' />]<br /><br />--<br />Frank Kalis<br />Microsoft SQL Server MVP<br />Contributing Editor, Writer & Forum Moderator<a target="_blank" href=http://www.sql-server-performance.com>http://www.sql-server-performance.com</a><br />Webmaster:<a target="_blank" href=http://www.insidesql.de>http://www.insidesql.de</a>
  3. dineshasanka Moderator

    If it is sql server 2005, you can find a rename option if you right click the dbname at SQL Server Management Studio

    ----------------------------------------
    Contributing Editor, Writer & Forums Moderator
    http://www.SQL-Server-Performance.Com

    Visit my Blog at
    http://dineshasanka.spaces.live.com/
  4. Madhivanan Moderator

    Also make sure that the applications connected to that db are not affected [<img src='/community/emoticons/emotion-1.gif' alt=':)' />]<br /><br />Madhivanan<br /><br />Failing to plan is Planning to fail
  5. MohammedU New Member

    You need to kill all users before renaming the database...

    ALTER DATABASE <DB NAME>
    SET SINGLE_USER
    WITH ROLLBACK IMMEDIATE;
    GO
    ALTER DATABASE MODIFY .... OR
    EXEC sp_renamedb N'db name', N'new db name';


    MohammedU.
    Moderator
    SQL-Server-Performance.com

    All postings are provided “AS IS” with no warranties for accuracy.
  6. pinky New Member

    thank u it's working.

Share This Page