Syntax of FILEGROUPPROPERTY Function :
FILEGROUPPROPERTY ( filegroup_name, property )
filegroup_name is a name of filegroup. It corresponds to the groupname column in sysfilegroups. It is of type nvarchar(128).
property is a name of the filegroup property. It is of type varchar(128) and can be of below values.
Value | Description | Returned Value |
IsReadOnly | Filegroup name is read-only. | 1 = True 0 = False NULL = Invalid input |
IsUserDefinedFG | Filegroup name is a user-defined filegroup. | 1 = True 0 = False NULL = Invalid input |
IsDefault | Filegroup name is the default filegroup. | 1 = True 0 = False NULL = Invalid input |
Return type of FILEGROUPPROPERTY function is integer.
Examples of FILEGROUPPROPERTY Function :
Example 1 : Use of FILEGROUPPROPERTY function in select clause
SELECT FILEGROUPPROPERTY('primary', 'IsDefault')
Output
1
Above example returns value 1 for property IsDefault means primary filegroup is a default filegroup.