sp_helpfilegroup (Transact-SQL)


Returns the names and attributes of filegroups associated with the current database.

Applies to: SQL Server (SQL Server 2008 through current version).

Topic link icon Transact-SQL Syntax Conventions

sp_helpfilegroup [ [ @filegroupname = ] 'name' ]  

[ @filegroupname = ] 'name'
Is the logical name of any filegroup in the current database. name is sysname, with a default of NULL. If name is not specified, all filegroups in the current database are listed and only the first result set shown in the Result Sets section is displayed.

0 (success) or 1 (failure)

Column nameData typeDescription
groupnamesysnameName of the filegroup.
groupidsmallintNumeric filegroup identifier.
filecountintNumber of files in the filegroup.

If name is specified, one row for each file in the filegroup is returned.

Column nameData typeDescription
file_in_groupsysnameLogical name of the file in the filegroup.
fileidsmallintNumeric file identifier.
filenamenchar(260)Physical name of the file including the directory path.
sizenvarchar(15)File size in kilobytes.
maxsizenvarchar(15)Maximum size of the file.

This is the maximum size to which the file can grow. A value of UNLIMITED in this field indicates that the file grows until the disk is full.
growthnvarchar(15)Growth increment of the file. This indicates the amount of space added to the file every time new space is required.

0 = File is a fixed size and will not grow.

Requires membership in the public role.

A. Returning all filegroups in a database

The following example returns information about the filegroups in the AdventureWorks2012 sample database.

USE AdventureWorks2012;  
EXEC sp_helpfilegroup;  

B. Returning all files in a filegroup

The following example returns information for all files in the PRIMARY filegroup in the AdventureWorks2012 sample database.

USE AdventureWorks2012;  
EXEC sp_helpfilegroup 'PRIMARY';  

Database Engine Stored Procedures (Transact-SQL)
sp_helpfile (Transact-SQL)
sys.database_files (Transact-SQL)
sys.master_files (Transact-SQL)
sys.filegroups (Transact-SQL)
System Stored Procedures (Transact-SQL)
Database Files and Filegroups

Community Additions