Syscomments table parsing in SQL Server

Source: Internet
Author: User
Sys. syscomments (Transact-SQL)

Items that contain each view, rule, DEFAULT value, trigger, CHECK constraint, DEFAULT constraint, and stored procedure in the database.TextThe column contains the original SQL Definition Statement.

Category: SQLServer

Column name

Data Type

Description

Id

Int

The object ID that applies to the text.

Number

Smallint

The number in the process group.

0 = item is not a process.

Colid

Smallint

The row serial number defined by the object that contains more than 4,000 characters.

Status

Smallint

Marked as for reference only. Not supported. Future compatibility is not guaranteed.

Ctext

Varbinary (8000)

The original bytes of the SQL Definition Statement.

Texttype

Smallint

0 = user-provided comments

1 = comments provided by the system

4 = encrypted comment

Language

Smallint

Marked as for reference only. Not supported. Future compatibility is not guaranteed.

Encrypted

Bit

Indicates whether the process definition has been blurred.

0 = unprocessed

1 = blurred

Important:

To blur the definition of a stored PROCEDURE, use the create procedure statement with the ENCRYPTION keyword.

Compressed

Bit

Always Returns 0. This value indicates that the process has been compressed.

Text

Nvarchar (4000)

The actual text of the SQL Definition Statement.

SQL Server 2008 decodes and stores the SQL expressions in the directory metadata in a different way than SQL Server 2000. The semantics of the decoded expression is equivalent to that of the original text, but there is no syntax guarantee. For example, space is deleted from the decoded expression.

If exists (select * from dbo. syscomments where id = object_id (n' [dbo]. [P_XXXXX] ')

Select c. text as SQL statement, c. encrypted, convert (nchar (2), o. xtype) as type, datalength (c. text) as length from dbo. syscomments c, dbo. sysobjects o where o. id = c. id and c. id = object_id (n' [dbo]. [P _ comprehensive refund _ contract number with value 2] ') order by c. number, c. colid option (robust plan)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.