Returns the specified file name property value when given a file name and property name.
FILEPROPERTY(file_name, property)
| Value | Description | Value returned |
|---|---|---|
| IsReadOnly | File is read-only. | 1 = True 0 = False NULL = Invalid input |
| IsPrimaryFile | File is the primary file. | 1 = True 0 = False NULL = Invalid input |
| IsLogFile | File is a log file. | 1 = True 0 = False NULL = Invalid input |
| SpaceUsed | Amount of space used by the specified file. | Number of pages allocated in the file |
int
This example returns the setting for the IsPrimaryFile property for the master file name in the master database.
USE master
SELECT FILEPROPERTY('master', 'IsPrimaryFile')
| Control-of-Flow Language | UPDATE |
| DELETE | WHERE |
| INSERT | Metadata Functions |
| SELECT |