Monday, December 11, 2006

Column Data Types

The following system data types can be used in creating a table. This is also the data type precedence (see MS Doc):
  • user-defined data types (highest)
  • sql-variant
  • xml
  • datetime
  • smalldatetime
  • float
  • real
  • decimal
  • money
  • smallmoney
  • bigint
  • int
  • smallint
  • tinyint
  • bit
  • text
  • image
  • timestamp
  • uniqueidentifier
  • nvarchar
  • nchar
  • varchar
  • char
  • varbinary
  • binary (lowest)
See MS documentation: Data Types (Transact-SQL)

char, varchar, binary, or varbinary can be combined into something with a length of 8,000 characters minus 1.

nchar, nvarchar expression will be smaller than 4,000.

See Precision, Scale, and Length (Transact-SQL)

No comments: