Interpreting type codes in sys.objects in SQL Server
Posted
by fatcat1111
on Stack Overflow
See other posts from Stack Overflow
or by fatcat1111
Published on 2010-05-25T17:43:03Z
Indexed on
2010/05/25
18:21 UTC
Read the original article
Hit count: 180
sql-server
|types
On SQL Server, the sys.objects table includes "Type" and "Type_Desc" attributes. For example:
SELECT DISTINCT [Type], Type_Desc
FROM Sys.Objects
ORDER BY [Type]
Returns:
C CHECK_CONSTRAINT D DEFAULT_CONSTRAINT F FOREIGN_KEY_CONSTRAINT FN SQL_SCALAR_FUNCTION FS CLR_SCALAR_FUNCTION IT INTERNAL_TABLE P SQL_STORED_PROCEDURE PK PRIMARY_KEY_CONSTRAINT S SYSTEM_TABLE SQ SERVICE_QUEUE TR SQL_TRIGGER U USER_TABLE UQ UNIQUE_CONSTRAINT V VIEW
Is there a comprehensive list of these types somewhere? There isn't a constraint on sys.objects that points me to table of these, and sys.types contains data types. I've searched SQL BOL but haven't found it. Any help would be appreciated.
EDIT: Some DBs use only a subset of these types. For example, if I have a database with no views, when I query Sys.Objects as above, there are no "V" rows in the results. I am looking for a list of all possible types and descriptions used by SQL Server.
© Stack Overflow or respective owner