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
If you have a hot tip and we publish it, we'll pay you. However, due to accounting overhead we no longer pay $10 for a single tip submission. You must accumulate 10 acceptable tips to receive payment. Be sure to include a clear explanation of what the technique does and why it's useful. If it includes code, limit it to 20 lines if possible.
Submit your tip here.