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!