====== Sysobject SQL ======
Code snippets that get useful information out of the sysobjects table.
^ Sysobjects.type ^ Meaning (SQL Server) ^ Meaning (Sybase) ^
| C | CHECK constraint | Computed column |
| D | Default or DEFAULT constraint | Default |
| F | FOREIGN KEY constraint | SQLJ function |
| FN | Scalar function | |
| IF | Inlined table-function | |
| L | Log | Log |
| N | | Partition condition |
| P | Stored procedure | Transact-SQL or SQLJ procedure |
| PK | PRIMARY KEY constraint (type is K) | |
| PR | | Prepare objects (created by Dynamic SQL) |
| R | | Rule |
| RF | Replication filter stored procedure | |
| RI | | Referential constraint |
| S | System table | System table |
| TF | Table function | |
| TR | Trigger | Trigger |
| U | User table | User table |
| V | View | View |
| X | Extended stored procedure | |
| XP | | Extended stored procedure |
===== All User Tables =====
select sysobjects.name as TableName
, *
from sysobjects
where sysobjects.type = 'U'
===== All Columns from User Tables =====
select sysobjects.name as TableName
, syscolumns.name as ColumnName
, *
from sysobjects
join syscolumns on syscolumns.id = sysobjects.id
where sysobjects.type = 'U'
===== All Identity Columns from User Tables =====
select sysobjects.name as TableName
, syscolumns.name as ColumnName
, *
from sysobjects
join syscolumns on syscolumns.id = sysobjects.id
where sysobjects.type = 'U'
and syscolumns.status >= 128
{{tag>code_snippet sql sysobjects}}