Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MSSQL Path

Status
Not open for further replies.

kozmark

IS-IT--Management
Sep 13, 2004
1
US
Anyone know how to identify the run path for MSSQL on a server ? I'd like to use this in my vbs program.
Thanks,
Cheryl
 
It can vary depending on the location that you choose to install SQL Server.

If you are looking for the MSSQLServer service than you can do a search for sqlservr.exe or navigate to the mssql\binn folder where you installed SQL Server.

Hope this is what you were looking for.

jitter
 
The info you are looking for should be in the registry. the following SQL code reads the registry and returns the value for the SQL Code path and SQL data path. This is on SQL7, the same principal works on SQL2K but you may have to change the keys.

Declare @Instpath varchar(50), @Datapath varchar(50)

exec master.dbo.xp_regread @rootkey='HKEY_LOCAL_MACHINE', @key='SOFTWARE\Microsoft\MSSQLServer\Setup',
@value_name='SQLPath',@value=@Instpath output
print @Instpath

exec master.dbo.xp_regread @rootkey='HKEY_LOCAL_MACHINE', @key='SOFTWARE\Microsoft\MSSQLServer\Setup',
@value_name='SQLDataRoot',@value=@Datapath output
print @Datapath
 
Try this if you are on SQL2K

USE master
GO

DECLARE @install_path NVARCHAR(260)

EXEC sp_MSgettools_path @install_path OUTPUT

SELECT @install_path

GO
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top