Numeric Data

Numeric data consists of numbers only. Numeric data includes positive and negative numbers, decimal and fractional numbers, and whole numbers (integers).

Integer Data

Integer data consists of negative or positive whole numbers, such as -15, 0, 5, and 2509. Integer data is stored using the int, smallint, and tinyint data types in Microsoft® SQL Server™. The int data type can store a larger range of integers than smallint, which can store a larger range of numbers than tinyint. Use the int data type to store numbers in the range from -2,147,483,648 through 2,147,483,647 only (requires 4 bytes of storage per value). Use the smallint data type to store numbers in the range from -32,768 through 32,767 only (requires 2 bytes of storage per value), and the tinyint data type to store numbers in the range from 0 through 255 only (requires 1 byte of storage per value).

Decimal Data

Decimal data consists of data that is stored to the least significant digit. Decimal data is stored using decimal or numeric data types in SQL Server. The number of bytes it takes to store a decimal or numeric value depends on the total number of digits for the data and the number of decimal digits to the right of the decimal point. For example, more bytes are required to store the value 19283.29383 than to store the value 1.1.

In SQL Server, the numeric data type is a synonym for the decimal data type.

Approximate Numeric Data

Approximate numeric (floating-point) data consists of data that is preserved as accurately as the binary numbering system can offer. Approximate numeric data is stored using the float and real data types in SQL Server. For example, because the fraction one-third in decimal notation is .333333 (repeating), this value cannot be represented precisely using approximate decimal data. Therefore, the value that is retrieved from SQL Server may not be exactly what was stored originally in the column. Additional examples of numeric approximations are floating-point values ending in .3, .6, and .7.

See Also
decimal and numeric Using Data Types
float and real Using Integer Data
int, smallint, and tinyint Using decimal, float, and real Data

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.