select FROM sysindexes WHERE id = object_id('HasText') : sysindexes « System Tables Views « SQL Server / T-SQL Tutorial






3> CREATE TABLE HasText
4> (
5> Col1 char(3)       NOT NULL,
6> Col2 text          NOT NULL,
7> Col3 varchar(5)    NULL,
8> Col4 varchar(20)   NOT NULL,
9> Col5 smallint      NULL
10> )
11> GO
1>
2> INSERT HasText VALUES
3>     ('AAA', REPLICATE('X', 250), NULL, 'ABC', 123)
4> GO

(1 rows affected)
1>
2> SELECT indid, first, name FROM sysindexes
3>     WHERE id = object_id('HasText')
4> GO
indid  first

                                                                                                                          name

------ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------
--------------------------------------------------
     0 0x7E0000000100

                                                                                                                          NULL


(1 rows affected)
1>
2>
3> drop table HasText;
4> GO
1>








27.30.sysindexes
27.30.1.select FROM sysindexes WHERE id = object_id('HasText')
27.30.2.table sysindexes contains a row for each index and a row for each table without a clustered index.
27.30.3.returns space usage information