SQL Server Datatypes

The list below shows that Microsoft SQL Server supports most SQL2003 datatypes. SQL Server supports additional datatypes used to uniquely identify rows of data within a table and across multiple servers, such as UNIQUEIDENTIFIER, 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

An interesting side note about SQL Server dates: SQL Server supports dates starting at the year 1753. 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.

BIGINT (SQL2003 Datatype: BIGINT)

Stores signed and unsigned integers between -9,223,372,036,854,775,808 and 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 1, 0, or NULL to indicate “unknown.” Up to 8 BIT columns on a single table will be stored in a single byte. An additional 8 BIT columns consume one more byte of storage space. ...

Get SQL in a Nutshell, 2nd 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.