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
 General SQL Server Forums
 New to SQL Server Programming
 Querying data file name

Author  Topic 

Zoroaster
Aged Yak Warrior

702 Posts

Posted - 2007-08-20 : 14:02:25
Is there a way to query the name of the physical data file and/or log file associated with a given database. For example if I were to do an alter database:
ALTER DATABASE X
MODIFY FILE
(NAME = xxxxx,
size=10MB)

Is there something I can type in to extract the file name associated with 'X' or do I have to know it implicitly?

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2007-08-20 : 14:07:52
try
sp_helpdb databasename

Jim
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-08-20 : 14:09:01
I think some of the sys.xxxxxxxxxx tables holds this information.



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

Zoroaster
Aged Yak Warrior

702 Posts

Posted - 2007-08-20 : 14:58:49
Thanks, I looked at sp_helpdb and found that the information is stored in sysfiles in each respective database.

Appreciate the info.

-Z
Go to Top of Page
   

- Advertisement -