syscolumns

Transact-SQL Reference

Transact-SQL Reference

syscolumns

Contains one row for every column in every table and view, and a row for each parameter in a stored procedure. This table is in each database.

Column name Data type Description
name sysname Name of the column or procedure parameter.
id int Object ID of the table to which this column belongs, or the ID of the stored procedure with which this parameter is associated.
xtype tinyint Physical storage type from systypes.
typestat tinyint For internal use only.
xusertype smallint ID of extended user-defined data type.
length smallint Maximum physical storage length from systypes.
xprec tinyint For internal use only.
xscale tinyint For internal use only.
colid smallint Column or parameter ID.
xoffset smallint For internal use only.
bitpos tinyint For internal use only.
reserved tinyint For internal use only.
colstat smallint For internal use only.
cdefault int ID of the default for this column.
domain int ID of the rule or CHECK constraint for this column.
number smallint Subprocedure number when the procedure is grouped (0 for nonprocedure entries).
colorder smallint For internal use only.
autoval varbinary(255) For internal use only.
offset smallint Offset into the row in which this column appears; if negative, variable-length row.
status tinyint Bitmap used to describe a property of the column or the parameter:

0x08 = Column allows null values.
0x10 = ANSI padding was in effect when varchar or varbinary columns were added. Trailing blanks are preserved for varchar and trailing zeros are preserved for varbinary columns.
0x40 = Parameter is an OUTPUT parameter.
0x80 = Column is an identity column.

type tinyint Physical storage type from systypes.
usertype smallint ID of user-defined data type from systypes.
printfmt varchar(255) For internal use only.
prec smallint Level of precision for this column.
scale int Scale for this column.
iscomputed int Flag indicating whether the column is computed:

0 = Noncomputed.
1 = Computed.

isoutparam int Indicates whether the procedure parameter is an output parameter:

1 = True.
0 = False.

isnullable int Indicates whether the column allows null values:

1 = True.
0 = False.