TechNet
Export (0) Print
Expand All

sys.syscomments (Transact-SQL)

 

THIS TOPIC APPLIES TO:yesSQL Server (starting with 2008)noAzure SQL DatabasenoAzure SQL Data Warehouse noParallel Data Warehouse

Contains entries for each view, rule, default, trigger, CHECK constraint, DEFAULT constraint, and stored procedure within the database. The text column contains the original SQL definition statements.

System_CAPS_ICON_important.jpg Important


This feature will be removed in a future version of Microsoft SQL Server. Do not use this feature in new development work, and modify applications that currently use this feature as soon as possible. We recommend that you use sys.sql_modules instead. For more information, see sys.sql_modules (Transact-SQL).

Applies to: SQL Server (SQL Server 2008 through current version).
Column nameData typeDescription
idintObject ID to which this text applies.
numbersmallintNumber within procedure grouping, if grouped.

0 = Entries are not procedures.
colidsmallintRow sequence number for object definitions that are longer than 4,000 characters.
statussmallintIdentified for informational purposes only. Not supported. Future compatibility is not guaranteed.
ctextvarbinary(8000)The raw bytes of the SQL definition statement.
texttypesmallint0 = User-supplied comment

1 = System-supplied comment

4 = Encrypted comment
languagesmallintIdentified for informational purposes only. Not supported. Future compatibility is not guaranteed.
encryptedbitIndicates whether the procedure definition is obfuscated.

0 = Not obfuscated

1 = Obfuscated

 ** Important ** To obfuscate stored procedure definitions, use CREATE PROCEDURE with the ENCRYPTION keyword.
compressedbitAlways returns 0. This indicates that the procedure is compressed.
textnvarchar(4000)Actual text of the SQL definition statement.

The semantics of the decoded expression are equivalent to the original text; however, there are no syntactic guarantees. For example, white spaces are removed from the decoded expression.

This SQL Server 2000-compatible view obtains information from current SQL Server structures and can return more characters than the nvarchar(4000) definition. sp_help returns nvarchar(4000) as the data type of the text column. When working with syscomments consider using nvarchar(max). For new development work, do not use syscomments.

Mapping System Tables to System Views (Transact-SQL)
Compatibility Views (Transact-SQL)

Community Additions

ADD
Show:
© 2016 Microsoft