SQL Flow Field Guide

sys.sp_helpindex

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

sphelpindex reports information about the indexes on a table or view.

What changes

Input
Not stated in the Microsoft summary.
Output or change
Not stated in the Microsoft summary.

Syntax at a glance

sys.sp_helpindex [ @objname = ] N'objname'
[ ; ]

Work example

sphelpindex reports information about the indexes on a table or view.

Write a proposed call on paper. Name the target, required permission, expected change, and recovery step before any lab use.

Check your work Inspects indexes on the first visible indexed user table in the current database. The SELECT reads metadata and the procedure call is conditional.

Practice SQL

Open in SQL Flow

Open the SQL for a walkthrough. Run the example in SQL Server to check its result.

DECLARE @object_name nvarchar(517); SELECT TOP (1) @object_name = QUOTENAME(s.name) + N'.' + QUOTENAME(t.name) FROM sys.tables AS t JOIN sys.schemas AS s ON s.schema_id = t.schema_id WHERE t.is_ms_shipped = 0 AND EXISTS (SELECT 1 FROM sys.indexes AS i WHERE i.object_id = t.object_id AND i.index_id > 0) ORDER BY s.name, t.name; IF @object_name IS NOT NULL EXEC sys.sp_helpindex @objname = @object_name; ELSE SELECT N'No visible indexed user table in the current database.' AS check_message;

Open Microsoft Learn for full syntax, permissions, and details for your version.