How to rename SQL Server 2005 database files

Posted on 2007-07-31
Last Modified: 2012-06-27
I created a database and added data etc. Now I want to rename it. I right clicked and renamed the database in management studio. I was also able to change the logical name. But I'm not able to edit the actual mdf and log file names. I tried to detach the database and then rename the files and that cause the database to not be able to reattach.
Question by:tonyrodriguez
    1 Comment
    LVL 51

    Accepted Solution

    I usually create a new database with the new name.  I then backup the old database, and restore it into the new database and use the overwrite option and changing the 'Restore As' name to the new name (VERY IMPORTANT)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
    This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now