Each database have minimum of two files associated with database. If database has more than one filegroup it will have many files associated with one database. Following quick script will give you recordset per file of a database which are stored in master database.
SELECT name, physical_name, type_desc, state_desc
FROM sys.master_files
Above script will return following result set.
Reference : Pinal Dave (http://blog.SQLAuthority.com)












so much attention over American elections that even SQL got ELECT command?
how about witting more than 10 lines?
Saved the day again! Many thanks, Pinal. You have saved me hours of boring work.