Sign up ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Where can I set the folder to store a database in when I create a new Database in the Microsoft SQL 2008 Server?

share|improve this question

migrated from Dec 29 '11 at 14:37

This question came from our site for system and network administrators.

2 Answers 2

up vote 12 down vote accepted

Via the GUI, right click the main server node:

enter image description here

Programmatically, it is stored in the registry. You can see this here:

However, you'd typically specify paths, names, sizes etc in your CREATE DATABASE

share|improve this answer
+1 for method 2 in the link. –  brian Dec 30 '11 at 3:24

For clarification from gbn's answer, if you want to designate the locations when you first create the database do it with the CREATE DATABASE command


    CREATE DATABASE [DatabaseName]
    ( NAME = N'PRIMARY', FILENAME = N'F:\MSSQL\Data\PrimaryFile.mdf' , SIZE = 102400KB , MAXSIZE = UNLIMITED, FILEGROWTH = 10240KB ), 
( NAME = N'BASKET_data1', FILENAME = N'F:\MSSQL\Data\DataFile.ndf' , SIZE = 62914560KB , MAXSIZE = UNLIMITED, FILEGROWTH = 5242880KB )
     LOG ON 
    ( NAME = N'Acquisition_log', FILENAME = N'E:\MSSQL\Log\logFile.ldf' , SIZE = 83886080KB , MAXSIZE = UNLIMITED, FILEGROWTH = 5242880KB )
     COLLATE SQL_Latin1_General_CP1_CI_AS

note that the size of these files is quite large (depending on what you're doing,

Its advisable to have your data and log files on separate drives and I've added in a separate Primary and Data file where DATA is the default file where new tables will be added, (its easier for DR if you there's a problem with the master database and its all in one file without having to worry about the rest of the database).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.