Syntax of FILEGROUP_ID Function :
FILEGROUP_ID ( 'filegroup_name' )
filegroup_name is a filegroup name to get filegroup ID. It corresponds to the groupname column in sysfilegroups. It is of type nvarchar(128).
Return type of FILEGROUP_ID function is smallint.
Examples of FILEGROUP_ID Function :
Example 1 : Use of FILEGROUP_ID function in select clause
SELECT FILEGROUP_ID('primary')
Output
1
Above example returns filegroup id for filegroup name primary.