日期:2014-7-1 浏览次数:20836次

--更改数据库默认存储路径

EXEC xp_instance_regwrite
@rootkey='HKEY_LOCAL_MACHINE',
@key='Software\Microsoft\MSSQLServer\MSSQLServer',
@value_name='DefaultData',
@type=REG_SZ,
@value='D:\MSSQL'
GO

 

--更改日志存储路径

EXEC master..xp_instance_regwrite
@rootkey='HKEY_LOCAL_MACHINE',
@key='Software\Microsoft\MSSQLServer\MSSQLServer',
@value_name='DefaultLog',
@type=REG_SZ,
@value='D:\MSSQL'
GO