Tuesday, April 26, 2011

Which is the SQL Server Install Path?

Easy to do. This tutorial shows how to read registry keys also:

declare @SmoRoot nvarchar(512)
exec master.dbo.xp_instance_regread N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSSQLServer\Setup', N'SQLPath', @SmoRoot OUTPUT
select @SmoRoot

Results:
c:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL

No comments:

Post a Comment