Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2002
    Posts
    9

    Unanswered: Obtaining PATH to master DB

    I need to obtain the path to the master DB in a Wise install script. I know that for SQL2K it is in the registry key:
    HKLM\Software\Microsoft\MSSQLServer\Setup

    It seems that a SQL2005 installation does not have the same default
    directory.

    Is there a way to query this from the server itself so I don't have to read the registry?

  2. #2
    Join Date
    Dec 2002
    Posts
    1,245
    With the usual caveat that it is not a 'best practice' to query the system tables, you can find the answer by executing:

    Code:
    SELECT filename 
    FROM sysfiles
    while connected to the master database. You will get two records. One is the data file, one is the log file. You can narrow the query by adding:
    Code:
    WHERE name = 'master'
    Regards,

    hmscott

    Edit to add: I did verify this against a SQL 2005 instance we are running in development, but it will also work in SQL2K.
    Have you hugged your backup today?

Posting Permissions

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