Código SQL:
Ver originalDROP TABLE #tables
DECLARE @tabla sysname
DECLARE @record INT
CREATE TABLE #tables (id INT IDENTITY PRIMARY KEY, name sysname)
INSERT INTO #tables (name)
SELECT name FROM sysobjects WHERE TYPE='U' ORDER BY name
SET @record = 1
WHILE @record <= (SELECT MAX(id) FROM #tables)
BEGIN
SELECT @tabla = name FROM #tables WHERE id = @record
SELECT @tabla
EXEC sp_helpindex @tabla
SET @record = @record + 1
END
GO