Skip to content

Commit

Permalink
Use correct registry path to get SQL's Data folder
Browse files Browse the repository at this point in the history
  • Loading branch information
minton authored Jun 10, 2020
1 parent d73ef9a commit 2c76330
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/DataButler/Utilities/Database.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static void SetDefaultDataDirectory(SqlConnection con)
{
Log("Retrieving SQL's data directory...");
var getSqlPathQuery = @"declare @SmoRoot nvarchar(512)
exec master.dbo.xp_instance_regread N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSSQLServer\Setup', N'SQLPath', @SmoRoot OUTPUT
exec master.dbo.xp_instance_regread N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSSQLServer\Setup', N'SQLDataRoot', @SmoRoot OUTPUT
select @SmoRoot";
var sqlPath = con.Query<string>(getSqlPathQuery).SingleOrDefault();
DefaultDataDirectory = Path.Combine(sqlPath, "Data");
Expand Down

0 comments on commit 2c76330

Please sign in to comment.