Results 1 to 4 of 4
  1. #1
    Join Date
    May 2003
    Posts
    20

    Question Unanswered: How to get the default data path of a SQL Server?

    Could I get the default data path of a SQL Server if under following condition:
    1) I have only known the SQL Server Name in my network.
    2) I am using a workstation computer that connects to a SQL Server through network.
    3) I can use store procedure.

    The result I wanted is the default data path of a SQL Server like:
    "[SQL Server Installed path]\MSSQL\Data", ie. most common case "C:\Program Files\Microsoft SQL Server\MSSQL\Data"

    Does any method or store procedure could do the above case?

  2. #2
    Join Date
    May 2003
    Posts
    20

    Unhappy How to get the default data path of a SQL Server?

    I forget to state the following point:
    1) I also need to handle the case if a SQL Server in network has multiple instances.
    2) I use a SQL Server 2000.

  3. #3
    Join Date
    May 2003
    Posts
    3

    Re: How to get the default data path of a SQL Server?

    Hi,

    One easy method is,

    SELECT * FROM master..sysdatabases WHERE name LIKE '<database name>'

    You can also find information @ http://support.microsoft.com/default...72705&SD=MSKB&

    Thanks
    Yogish

    Originally posted by king
    Could I get the default data path of a SQL Server if under following condition:
    1) I have only known the SQL Server Name in my network.
    2) I am using a workstation computer that connects to a SQL Server through network.
    3) I can use store procedure.

    The result I wanted is the default data path of a SQL Server like:
    "[SQL Server Installed path]\MSSQL\Data", ie. most common case "C:\Program Files\Microsoft SQL Server\MSSQL\Data"

    Does any method or store procedure could do the above case?

  4. #4
    Join Date
    Aug 2002
    Location
    Scotland
    Posts
    1,578
    by Alexander Chigrik
    USE master
    GO
    DECLARE @install_path NVARCHAR(260)
    EXEC sp_MSgettools_path @install_path OUTPUT
    SELECT @install_path
    GO


    ... its an undocumented XP available.
    --Satya SKJ
    Microsoft SQL Server MVP
    [IMG]http://sqlserver-qa.net/google_bart.gif[/IMG]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •