Skip to content

Latest commit

 

History

History
80 lines (61 loc) · 3.15 KB

sp-helpfile-transact-sql.md

File metadata and controls

80 lines (61 loc) · 3.15 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
sp_helpfile (Transact-SQL)
sp_helpfile returns the physical names and attributes of files associated with the current database.
markingmyname
maghan
randolphwest
08/22/2024
sql
system-objects
reference
sp_helpfile
sp_helpfile_TSQL
sp_helpfile
TSQL

sp_helpfile (Transact-SQL)

[!INCLUDE SQL Server]

Returns the physical names and attributes of files associated with the current database. Use this stored procedure to determine the names of files to attach to or detach from the server.

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

sp_helpfile [ [ @filename = ] N'filename' ]
[ ; ]

Arguments

[ @filename = ] N'filename'

The logical name of any file in the current database. @filename is sysname, with a default of NULL. If @filename isn't specified, the attributes of all files in the current database are returned.

Return code values

0 (success) or 1 (failure).

Result set

Column name Data type Description
name sysname Logical file name.
fileid smallint Numeric identifier of the file. A value isn't returned if @filename is specified.
filename nchar(260) Physical file name.
filegroup sysname Filegroup in which the file belongs.

NULL = File is a log file. Log files are never a part of a filegroup.
size nvarchar(15) File size in kilobytes.
maxsize nvarchar(15) 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.
growth nvarchar(15) Growth increment of the file. This value indicates the amount of space added to the file every time that new space is required.

0 = File is a fixed size and doesn't grow.
usage varchar(9) For data file, the value is data only, and for the log file the value is log only.

Permissions

Requires membership in the public role.

Examples

The following example returns information about the files in [!INCLUDE ssSampleDBobject].

USE AdventureWorks2022;
GO
EXEC sp_helpfile;
GO

Related content