SQL 2005 - default new database file location

  • Hello,  we just installed SQL2005 and can not find how to change the default location that a new database will be created in.  We want SQL to point to direct storage drive E:\.  We are all newbies at 2005.

     

    thanks,

     

     

  • In SQL Server Management Studio connect to your SQL2005 instance.  In Management Studio under that instance right-click on the "Databases" sub-group and choose New Database.  On the General page you'll specify the name of your new database.  In the lower section of the General page is the Database files section.  You can scroll over to the right to the "Path" column and click on the ellipse in that column.  This will allow you to browse to the available drives and directories on your SQL 2005 Server.  Sounds like you just want to select someplace on your E drive.  You can set the path locations for your mdf and/or ldf files if you want to.

    This process would set the path for an individual new database.  As far as changing the "default location" for all new databases that's another story.  I believe SQL2005 stores that is the registry of the server- in a SQLDataRoot key in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\Setup... but of course I would NOT recommend editing that unless you know what you're doing and the impacts of editing the registry.  You can do yourself a lot of damage if you're not careful.

  • SERVER--PROPERTIES--DATABASE SETTINGS

  • Wow- thanks- I can't believe I never noticed that!

  • Thank you all very much for your replys. 

  • I just found this out myself yesterday, pitty it was 3 days after I set-up all my databases manually...always the way!

  • Help a total Newbie!!! I want to relocate my database files, but we don't have the Management tools with SQL 2005 express. Can someone please offer suggestions? (The database was created from within Visual Studio 2005, and it insists on putting the database .mdf file in its own project path on my local machine.)

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply