SQL Server Datatypes

Microsoft SQL Server supports most SQL2003 datatypes, as well as some additional datatypes used to uniquely identify rows of data within a table and across multiple servers, such as UNIQUEIDENTIFIER. These datatypes are included in support of Microsoft’s hardware philosophy of “scale-out” (that is, deploying on many Intel-based servers) rather than “scale-up” (deploying on a single huge, high-end Unix server or a Windows Data Center Server).

Tip

Here’s an interesting side note about SQL Server dates: SQL Server supports dates starting at the year 1753, and you can’t store dates prior to that year using any of SQL Server’s date datatypes. Why not? The rationale is that the English-speaking world started using the Gregorian calendar in 1753 (the Julian calendar was used prior to September, 1753), and converting dates prior to Julian to the Gregorian calendar can be quite challenging.

The datatypes SQL Server supports are:

BIGINT (SQL2003 datatype: BIGINT)

Stores signed and unsigned integers in the range of −9,223,372,036,854,775,808 to 9,223,372,036,854,775,807, using 8 bytes of storage space. See INT for IDENTITY property rules that also apply to BIGINT.

BINARY[(n)] (SQL2003 datatype: BLOB)

Stores a fixed-length binary value of 1 to 8,000 bytes in size. BINARY datatypes consume n + 4 bytes of storage space.

BIT (SQL2003 datatype: BOOLEAN)

Stores a value of 1, 0, or NULL (to indicate “unknown”). Up to eight BIT columns on a single table will be stored in a single byte. ...

Get SQL in a Nutshell, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.