SQL Server sysobjects Table contains one row for each object created within a database. In other words, it has a row for every constraint, default, log, rule, stored procedure, and so on in the database. Therefore, this table can be used to retrieve information about the database. We can use xtype column in sysobjects table to get useful database information. This column specifies the type for the row entry in sysobjects.
For example, you can find all the user tables in a database by using this query:
select * from sysobjects where xtype='U'
Similarly, you can find all the stored procedures in a database by using this query:
select * from sysobjects where xtype='P'
This is the list of all possible values for this column (xtype):
- C = CHECK constraint
- D = Default or DEFAULT constraint
- F = FOREIGN KEY constraint
- L = Log
- P = Stored procedure
- PK = PRIMARY KEY constraint (type is K)
- RF = Replication filter stored procedure
- S = System table
- TR = Trigger
- U = User table
- UQ = UNIQUE constraint (type is K)
- V = View
- X = Extended stored procedure