FILE_ID Function

| 0 Comments

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('Northwind')



Output

1

Above example returns id for Northwind file.



Leave a Reply