Stuff we should know, but always have to look up: SQL Server 2005 - setting the default directory for the mdf/ldf

Technology Yogi has done an easy to follow article on it: here

Essentially, run the following commands, assuming ‘D:\SQL_Data’ is where you want to place the mdf and ldf files.

USE [master]
GO
EXEC xp_instance_regwrite N’HKEY_LOCAL_MACHINE’, N’Software\Microsoft\MSSQLServer\MSSQLServer’, N’DefaultData’, REG_SZ, N’D:\SQL_Data’
GO
EXEC xp_instance_regwrite N’HKEY_LOCAL_MACHINE’, N’Software\Microsoft\MSSQLServer\MSSQLServer’, N’DefaultLog’, REG_SZ, N’D:\SQL_Data’
GO

SpittingCAML




You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply