mdf and ldf files RRS feed

  • Question

  • Can I rename the mdf and ldf files?
    Friday, October 1, 2010 5:55 AM


  • SQL 2005 onwards

    ALTER DATABASE allow you to change the physical name in the system tables, but it won't rename the physical file. For that you have to ALTER DATABASE to rename the physical file, stop SQL Server, rename the file in the file system (and make no mistakes here) then start SQL Server.
    IMO, detach and attach is easier.


    Balmukund Lakhani | Please mark solved if I've answered your question
    This posting is provided "AS IS" with no warranties, and confers no rights.
    My Blog: http://blogs.msdn.com/blakhani
    Team Blog: http://blogs.msdn.com/sqlserverfaq
    Friday, October 1, 2010 6:33 AM