Description of the xtype field value in the sysobjects table of the SQL Server database

Source: Internet
Author: User

We often want to query the index, constraints, relevance, and trigger attributes of a table. We need to know the meaning of the fields in the table "sysobjects", so no matter what we need to query, there is no problem!

Sysobjects: each database in the SQL-SERVER has this system table, which stores all the objects created in the database, such as constraints, default values, logs, rules, stored procedures, etc, each object occupies one row in the table. The following table describes the field names and descriptions of the system table.
Name, ID, xtype, uid, status: Object Name, Object ID, object type, user ID of the owner object, and object status.
Object Type (xtype ). It can be one of the following object types:

Object type. can be one of the following object types:

AF = aggregate function (CLR)

C = check Constraint

D = default or default Constraint

F = foreign key constraint

L = Log

Fn = scalar function

FS = assembly (CLR) Scalar-Function

FT = assembly (CLR) Table-Valued Function

If = In-lined table-Function

It = internal table

P = Stored Procedure

PC = assembly (CLR) stored-Procedure

PK = primary key constraint (type is K)

Rf = replication filter Stored Procedure

S = system table

Sn = Synonym

Sq = Service Queue

Ta = assembly (CLR) DML trigger

TF = Table Function

Tr = SQL DML trigger

Tt = table Type

U = User table

Uq = unique constraint (type is K)

V = View

X = Extended Stored Procedure

When xtype = 'U' and status> 0 indicates that the table is created by the user, the object name is the table name, and the Object ID is the table id value.
Use: Select * From Misa. DBO. sysobjects where xtype = 'U' and status> 0 to list the table names created by all users in Misa.

Select * From sysobjects where parent_obj = object_id ('cs ') and xtype = 'tr'
Lists all attributes of table CS. The above is a trigger!

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.