December 1, 2004 at 6:30 pm
Under the properties of SQL Server you can set a default location for database and log files. I know this information is stored in the registry, but is there a way that this information can be retrieved using TSQL, without having to write a custom dll to access the registry.
December 1, 2004 at 10:07 pm
Never mind, I managed to answer it myself.
After a little search, I found a reference to the extended sp xp_regread, and found a gem of a hint on how to use it on MSDN.
The solution is as follows.
DECLARE @DefaultData VARCHAR(256), @DefaultLog VARCHAR(256)
exec master..xp_regread 'HKEY_LOCAL_MACHINE', 'SOFTWARE\Microsoft\MSSQLServer\MSSQLServer',
'DefaultData', @DefaultData OUT
exec master..xp_regread 'HKEY_LOCAL_MACHINE', 'SOFTWARE\Microsoft\MSSQLServer\MSSQLServer',
'DefaultLog', @DefaultLog OUT
PRINT @DefaultData
PRINT @DefaultLog
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply