Datasheet
13
Chapter 1: Introducing T-SQL and Data Management Systems
Data Type Storage Description
varbinary Up to
2,147,483,647
bytes
Variable - length binary data type identical to the
binary data type, with the exception of consuming
only the amount of storage that is necessary to hold
the data. Using the
(MAX) option allows for the
storage of up to 2GB of binary data. However, only 1
through 8000 or
MAX can be specified as storage
options.
image Up to
2,147,483,647
bytes
The image data type is similar to the varbinary
data type in that it is a variable - length binary data
type. The significant difference is the maximum length
of about 2GB and where the data is physically stored.
With a
varbinary data type on a table column, the
data is stored physically in the row with the rest of the
data. With an
image data type, however, the data is
stored separately from the actual row and a pointer
is stored in the row so that SQL Server can find the
data. Typically,
image data types are used to store
actual images, binary documents, or binary objects.
The
image data type is functionally identical to
varbinary(MAX) .
Other Data Types
timestamp 8 bytes The timestamp data type has nothing to do with
time. It is more accurately described as a data
type that maintains row version data. In light of this
fact, a system alias of
rowversion is available for
this data type and is generally preferred to avoid
confusion. What
timestamp actually provides is
a database unique identifier to identify a version of a
row. Every time a row that contains a
timestamp data
type is modified, the value of the timestamp changes.
uniqueidentifier 32 bytes A data type used to store a globally unique identifier
(GUID).
*
hierarchyid Up to 892
bytes
The hierarchyid data type is a variable length data
type that is used to represent position in a hierarchy.
sql_ variant
Up to 8016
bytes
sql_variant is used when the exact data type is
unknown. It can be used to hold any data type with
the exception of
text , ntext , image , and timestamp .
xml
Up to 2GB The xml data type is used to store well - formed
XML. The XML stored can be specified to be well -
formed fragments or complete documents and can be
enforced with an XML schema bound to the variable,
parameter, or column containing the XML data.
CH001.indd 13CH001.indd 13 3/26/10 11:35:39 AM3/26/10 11:35:39 AM