'Getting Count of sp_helpindex

How do I get count of the below sp?

EXEC sp_helpindex 'dbo.MachineLog' 

I want the count of the results. Can anyone help with the syntax.

I tried below :-

select Count(*) from 
EXEC sp_helpindex 'dbo.MachineLog' 


Solution 1:[1]

Since sp_helpindex itself is a procedure, you can execute insert its result to a temp table and select from the temp table like this

Declare @Tbl Table (index_name varchar(128),index_desc varchar(512), index_keys varchar(16))
Insert @Tbl Exec sp_helpindex 'dbo. MachineLog' 
Select count(*) from @Tbl

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 HariHaravelan