FILE_ID Function


FILE_ID function in sql server with examples.

FILE_ID function is used to get file identification number for logical file name in the current database.

Syntax of FILE_ID Function :

FILE_ID ( 'file_name' )

file_name is a name of the file for which to return the file ID. It corresponds to the name column in sysfiles. It is of type nchar(128).

Return type of FILE_ID function is smallint.

Examples of FILE_ID Function :

Example 1 : Use of FILE_ID function in select clause

SELECT FILE_ID('Southwind')

Output

1

Above example returns id for Soundwind file.

Share/Bookmark

No comments: