Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Returns the logical file name for the given file identification (ID) number.
Transact-SQL Syntax Conventions
Syntax
FILE_NAME ( file_id )
Arguments
- file_id
Is the file identification number for which to return the file name. file_id is int.
Return Types
nvarchar(128)
Remarks
file_ID corresponds to the file_id column in the sys.master_files or sys.database_files catalog views.
Examples
The following example returns the file names for file
_ID 1
and file
_ID
in the AdventureWorks
database.
USE AdventureWorks;
GO
SELECT FILE_NAME(1) AS 'File Name 1', FILE_NAME(2) AS 'File Name 2';
GO
Here is the result set.
File Name 1 File Name 2
---------------- ------------------------
AdventureWorks_Data AdventureWorks_Log
(1 row(s) affected)
See Also
Reference
FILE_IDEX (Transact-SQL)
Metadata Functions (Transact-SQL)
sys.database_files (Transact-SQL)
sys.master_files (Transact-SQL)