Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 file path

Author  Topic 

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2008-06-30 : 09:51:19
Hi,
using sql, how can I find out where in the pc does the *.ldf file is?
Thanks

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-06-30 : 10:10:31
Have you tried the sysfiles yet?



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2008-06-30 : 10:25:59
yes, it gives the filename which includes the path of the .mdf and .ldf
At present I am interested in the path for the backups and logs.
Any thoughts please?
Thanks
Go to Top of Page

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2008-07-01 : 13:37:32
The sys.database_files table will explicitly tell you if the file is for Data or Logs but does not account for Backup files. The sys.backup_devices system view could be what you're looking for.

=======================================
Some people walk in the rain, others just get wet. -Roger Miller, musician (1936-1992)
Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2008-07-02 : 04:54:46
Hi,
select * from sys.backup_devices
returns no rows.
Any thoughts please?
Go to Top of Page

Wanderer
Master Smack Fu Yak Hacker

1168 Posts

Posted - 2008-07-02 : 04:58:56
Are you sure you've got a backup?
Also, another way (without select from system tables) to get location of files for a db is sp_helpdb DATABASENAME

*##* *##* *##* *##*
Chaos, Disorder and Panic ... my work is done here!
Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2008-07-02 : 05:03:42
yes, just created one and ran the query again.
Still does not return any rows. Only fields. i.e. name, type, type_desc, physical_name
Any thoughts please?
Thanks
Go to Top of Page
   

- Advertisement -