6/15/2023 0 Comments Sql server ma![]() ![]() ![]() You can achieve the same result by using SMO. Select 1, - charindex('\', nvarchar(512)Įxec _instance_regread N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer\Parameters', N'SqlArg2', output declare nvarchar(512)Įxec _instance_regread N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'DefaultData', outputĮxec _instance_regread N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'DefaultLog', outputĮxec _instance_regread N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'BackupDirectory', outputĮxec _instance_regread N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer\Parameters', N'SqlArg0', output This is simplified version of the query that SQL Management Studio runs.Īlso, note that I use xp_instance_regread instead of xp_regread, so this script will work for any instance, default or named. However, if these parameters aren't set explicitly, SQL server uses Data and Log paths of master database.īellow is the script that covers both cases. If the path is set explicitly at Properties => Database Settings => Database default locations then SQL server stores it at Software\Microsoft\MSSQLServer\MSSQLServer in DefaultData and DefaultLog values. It depends on whether default path is set for data and log files or not. ![]()
0 Comments
Leave a Reply. |