I'm trying to change the default directories for data and logs using SQL Server Management Studio. I change the path then click ok but it always reverts back to the old directory in Program Files. Anyone else seen this bug? I'm using SQL Server 2012 Standard.
I do see that the correct values are saved in the registry, but they aren't being obeyed by the studio or other connecting applications that would create new databases.
If it's a text file, then you could use File. ReadAllText() to get a string that you can save in your database. If it's not a text file, then you could use File. ReadAllBytes() to get the file's binary data, and then save that to your database.
The default database file location for server instances depends on the version of the Microsoft SQL Server software: SQL Server 2014 — C:\Program Files\Microsoft SQL Server\MSSQL12. MSSQLSERVER\MSSQL\DATA\ SQL Server 2016 — C:\Program Files\Microsoft SQL Server\MSSQL13.
According to Microsoft, you must restart the SQL Server service for this to take effect.
You can do this easily via the Configuration Manager, or via the services.msc
snap-in if you prefer that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With