• srbrewster (7/17/2008)


    I need the query to determine the mdf file location of a database.

    just change fileid to 1 instead of 2 as below

    select a.name, b.name as 'Logical filename', b.filename from sys.sysdatabases a

    inner join sys.sysaltfiles b

    on a.dbid = b.dbid where fileid = 1

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉