Where can I set the folder to store a database in when I create a new Database in the Microsoft SQL 2008 Server?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
migrated from serverfault.com Dec 29 '11 at 14:37
This question came from our site for system and network administrators.
Via the GUI, right click the main server node:
Programmatically, it is stored in the registry. You can see this here: http://blogs.technet.com/b/sqlman/archive/2009/07/20/tsql-script-determining-default-database-file-log-path.aspx
However, you'd typically specify paths, names, sizes etc in your CREATE DATABASE
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
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).