Applies To: SQL Server 2014, SQL Server 2016 Preview
Topic Status: Some information in this topic is preview and subject to change in future releases. Preview information describes new features or changes to existing features in Microsoft SQL Server 2016 Community Technology Preview 2 (CTP2).
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.
Applies to: SQL Server (SQL Server 2008 through current version).
The following example returns the setting for the IsPrimaryFile property for the AdventureWorks_Data file name in AdventureWorks2012 the database.
SELECT FILEPROPERTY('AdventureWorks2012_Data', 'IsPrimaryFile')AS [Primary File]; GO
Here is the result set.
Primary File ------------- 1 (1 row(s) affected)