In SQL Server Management Studio, there is an option to set the default database path for a given instance:
This works. When I say
CREATE DATABASE test
it gets created in the path I specify, E:\data
. Great.
But how do I get this path in T-SQL (for use in setup scripts)?
Contrary to what many pages say, there is no registry key (on my machine) for DefaultData
or DefaultLog
. I am running SQL Server 2005 Express on XP 64.
This value has got to be stored somewhere. Where?