How can I change the default location for database files that SQL creates?

A. Change/add the following registry keys :-

KEY: HKLM\Software\Microsoft\MSSQLServer\MSSQLServer
VALUE: DefaultData
VALUE: DefaultLog

Just put in a directory name (no trailing backslash) for these.

This works only for databases that you create with the CREATE DATABASE statement, not for databases created from Enterprise Manager.

(Answer courtesy of Kalen Delaney)


Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish