1declare @rc int, @dir nvarchar(4000)
2
3exec @rc = master.dbo.xp_instance_regread
4 N'HKEY_LOCAL_MACHINE',
5 N'Software\Microsoft\MSSQLServer\Setup',
6 N'SQLPath',
7 @dir output, 'no_output'
8select @dir AS InstallationDirectory
9