MS SQL Server stores the information about the objects (tables, views, functions, etc) stored in the database in a table, which is accessible by selecting from the sysobjects view (sql2000) or the sys.objects and sys.sysobjects views (sql2005, sql2008).
Object Type Abbreviation
- 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
You can query the sys.SysObjects to get all the objects created with in the database.
Examples
1. To Get Tables list.
SELECT *
FROM sys.sysobjects
WHERE TYPE = 'u'
FROM sys.sysobjects
WHERE TYPE = 'u'
2. To Get Stored Procedures list.
SELECT *
FROM sys.sysobjects
WHERE TYPE = 'p'
FROM sys.sysobjects
WHERE TYPE = 'p'
No comments:
Post a Comment