syscomments (all databases)

Contains entries for each view, rule, default, trigger, CHECK constraint, DEFAULT constraint, and stored procedure. The text field contains the original SQL definition statements. Since text is often longer than 255 characters, entries often span rows. Each object can occupy as many as 255 rows.

Column Datatype Description
id int Object ID to which this text applies.
number smallint Number within procedure grouping, if grouped. 0 for nonprocedure entries.
colid tinyint Row sequence number for object definitions longer than 255 characters.
texttype smallint 0    User-supplied comment (users can add
    entries that describe an object or column)

1    System-supplied comment (for views, rules,
    defaults, triggers, and stored procedures)

4    Encrypted comments (applies to
    procedures, triggers and views)

language smallint Reserved.
text varchar(255) Actual text of the SQL definition statement.

Index

syscomments clustered, unique on id, number, colid, texttype

Referenced by Stored Procedures

sp_helpconstraint sp_helpextendedproc sp_helptext