Microsoft SQL Server database is one of the most commonly used database systems in enterprise development management. It is powerful and easy to use. We create databases, tables, views, triggers, stored procedures, functions, and other information in the database.
One of the most commonly used features for querying data, such as:
1 SELECT [Sysareaid]2,[AreaName]3,[Areanamepinyin]4,[ShortName]5,[Areatypeid]6,[Depth]7,[ParentID]8,[Postcode]9 from [Savionplatmisdb].[dbo].[Sysarea]
Query results such as:
The results show that the query results are displayed in the form of mesh rows and columns. This is one of the characteristics of a relational database.
So how do we store information such as tables, views, and so on? In fact, SQL Server database is a kind of "self-explanatory" is the storage medium. The tables, views, etc. that we create are also stored in their system default database and table.
One of them is the sysobjects table.
Each database in SQL Server has this system table, which holds all objects created within the database, such as constraints, defaults, logs, rules, stored procedures, and so on, with each object occupying one row in the table.
The following is the field name and description for this system table.
Column Name |
Data Type |
Description |
Name |
sysname |
The name of the object. |
Id |
Int |
The object identification number. |
Xtype |
CHAR (2) |
The object type. Can be one of the following object types: C = CHECK Constraint D = defaults or DEFAULT constraints F = FOREIGN KEY constraint L = Log FN = Scalar function IF = Inline Table function P = Stored Procedure PK = PRIMARY KEY constraint (type is K) RF = copy Filter stored procedure S = System table TF = Table function TR = Trigger U = User Table UQ = UNIQUE constraint (type is K) V = view X = Extended Stored Procedure |
Uid |
smallint |
The user ID of the owner object. |
Info |
smallint |
Keep. Internal use only. |
Status |
Int |
Keep. Internal use only. |
Base_schema_ Ver |
Int |
Keep. Internal use only. |
Replinfo |
Int |
Keep. For replication use. |
Parent_obj |
Int |
The object identification number of the parent object (for example, for a trigger or constraint, which is the table ID). |
Crdate |
Datetime |
The date the object was created. |
Ftcatid |
smallint |
Full-text catalog identifier for all user tables registered for full-text indexing, or 0 for all user tables that are not registered. |
Schema_ver |
Int |
The version number, which is incremented each time the schema of the table changes. |
Stats_schema_ Ver |
Int |
Keep. Internal use only. |
Type |
CHAR (2) |
The object type. Can be one of the following values: C = CHECK Constraint D = defaults or DEFAULT constraints F = FOREIGN KEY constraint FN = Scalar function IF = Inline Table function K = PRIMARY KEY or UNIQUE constraint L = Log P = Stored Procedure R = Rule RF = copy Filter stored procedure S = System table TF = Table function TR = Trigger U = User Table V = view X = Extended Stored Procedure |
Userstat |
smallint |
Keep. |
Sysstat |
smallint |
Internal state information. |
Indexdel |
smallint |
Keep. |
Refdate |
Datetime |
reserved for later use. |
Version |
Int |
reserved for later use. |
Deltrig |
Int |
Keep. |
Instrig |
Int |
Keep. |
Updtrig |
Int |
Keep. |
Seltrig |
Int |
Keep. |
Category |
Int |
Used for publishing, constraints, and identification. |
Cache |
smallint |
Keep. |
when xtype= ' U ' and status>0 represent a table created by the user, the object name is the table name, and the object ID is the ID value of the table.
Use the following code to list the table names created by all the users in the library Misa:
1 Select * from 2 where xtype='U' and status > 0
About one of the system tables in SQL Server sysobjects