Re: How to get Databse physical file name in 2005?



You can use the sys.master_files catalog view. For example,

SELECT physical_name
FROM sys.master_files
WHERE database_id = DB_ID('master')
--
Gail Erickson [MS]
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights

"Mike9900" <Mike9900@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:47CB0212-5C36-4BF9-9854-3F3099309FE5@xxxxxxxxxxxxxxxx
> In SQL 2000 I could write SELECT filename FROM sysdatabases WHERE
> name='MyDB'
> and got the physical file name with its path.
>
> But in 2005, I get empty string when I use the query in c#. But it works
> when I use it in the Management Studio.
> --
> Mike


.



Relevant Pages

  • Re: performance of MSDE
    ... Lead Programming Writer ... SQL Server Documentation Team ... This posting is provided "AS IS" with no warranties, ...
    (microsoft.public.sqlserver.msde)
  • Re: OK - Im stupid....How do you create a user?
    ... SQL Server Documentation Team ... This posting is provided "AS IS" with no warranties, ...
    (microsoft.public.sqlserver.security)
  • Re: MSDE Limitations
    ... SQL Server Documentation Team ... This posting is provided "AS IS" with no warranties, ...
    (microsoft.public.sqlserver.msde)
  • Re: DatabaseSpace SMO sample MIA?
    ... SQL Server Documentation Team ... This posting is provided "AS IS" with no warranties, ... Did it install for anyone else? ... I would greatly appreciate it if someone could point me to a download ...
    (microsoft.public.sqlserver.setup)