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 |
SELECT sysobjects.name AS TableName , * FROM sysobjects WHERE sysobjects.type = 'U'
SELECT sysobjects.name AS TableName , syscolumns.name AS ColumnName , * FROM sysobjects JOIN syscolumns ON syscolumns.id = sysobjects.id WHERE sysobjects.type = 'U'
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