FILEPROPERTY (Transact-SQL)
SQL Server 2008 R2
Returns the specified file name property value when a file name in the current database and a property name are specified. Returns NULL for files that are not in the current database.
The following example returns the setting for the IsPrimaryFile property for the AdventureWorks2008R2_Data file name in the AdventureWorks2008R2 database.
USE AdventureWorks2008R2;
GO
SELECT FILEPROPERTY('AdventureWorks2008R2_Data', 'IsPrimaryFile')AS [Primary File];
GO
Here is the result set.
Primary File ------------- 1 (1 row(s) affected)