syscomments

All databases

Description

syscomments contains entries for each view, rule, default, trigger, table constraint, and procedure. The text column contains the original definition statements. If the text column is longer than 255 bytes, the entries will span rows. Each object can occupy up to 65,025 rows.

Columns

The columns for syscomments are:

Name

Datatype

Description

id

int

Object ID to which this text applies

number

smallint

Sub-procedure number when the procedure is grouped (0 for non-procedure entries)

colid

smallint

Sequence of 255 rows for the object

texttype

smallint

0 for system-supplied comment (for views, rules, defaults, triggers, and procedures); 1 for user-supplied comment (users can add entries that describe an object or column)

language

smallint

Reserved

text

varchar(255) null

Actual text of SQL definition statement

colid2

smallint

Indicates next sequence of rows for the object (see colid above); object can have up to 255 sequences of 255 rows each

status

smallint null

NoteDo not delete the definition statements from the text column of syscomments. These statements are required for the Adaptive Server upgrade process. To encrypt a definition statement, run the system procedure sp_hidetext. To see if a statement created in release 11.5 or later was deleted, run sp_checksource. If the statement was deleted, you must either recreate the object that created the statement or reinstall the application that created the object, which will re-create the statement.

You can protect the text of a database object against unauthorized access by restricting select permission on the text column of the syscomments table to the owner of the object and the System Administrator. This restriction, which applies to direct access through select statements as well as access through stored procedures, is required in order to run Adaptive Server in the evaluated configuration. To enact this restriction, a System Security Officer must reset the parameter called allow select on syscomments.text column with the system procedure sp_configure. For information, see the System Administration Guide.

Indexes

Unique clustered index On id, number, icolid2, colid, texttype