-1

Can someone help me with any script like windows script, BAT script or SQLcmd script for changing the default database location of SQL.

I am using Windows

Dale K
  • 25,246
  • 15
  • 42
  • 71

1 Answers1

0

Not sure if it will fit to SQL Server 2005 as I use 2017 Express on my laptop, but give it a try...

USE [master]
GO
EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'DefaultData', REG_SZ, N'C:\DATA'
GO
EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'DefaultLog', REG_SZ, N'C:\DATA'
GO
Michał Lipok
  • 365
  • 6
  • 24