O'Reilly logo

SQL in a Nutshell, 3rd Edition by Kevin Kline

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required