Numeric Data Types in SQL Server

Here we will learn what are the numeric data types in sql server and use of numeric data types and different types of sql numeric data types.

SQL Numeric Data Types

In SQL, numeric data types are useful whenever we want to insert only numeric values in columns. By using numeric data types we can define a columns that accepts only numeric values. 

 

For example, in SQL table if we want to allow users to store only numeric values in particular column, then we need to define that column as numeric data type. In SQL we have a two different type of numeric data types available, those are

 

  •  Exact Numeric Data Types
  •  Approximate Numeric Data Types 

SQL Exact Numeric Data Types

The exact numeric data types in sql is used to store an integer type of data. Please check following table for exact numeric data types in sql server.

 

Data TypeDescriptionStorage Size
bit It’s single bit integer that can take values of 0, 1 or null  
tinyint It’s single Byte integer we can store values from 0 to 255 (Minval: 0, Maxval: 255) 1 Byte
smallint It’s 16 bit integer we can store values from -2^15 (-32,768) to 2^15 - 1 (32,767) 2 Bytes
int It’s 32 bit integer we can store values from -2^15 (-32,768) to 2^15 - 1 (32,767) 4 Bytes
bigint It’s 64 bit integer we can store values from -2^63 (-9223372036854775808) to 2^63-1 (9223372036854775807) 8 Bytes
decimal We can store values from -10^38 1 to 10^38 –1 5 - 17 Bytes
numeric We can store values from -10^38 1 to 10^38 –1 5 - 17 Bytes
smallmoney We can store monetary values from - 214,748.3648 to 214,748.3647 4 Bytes
money We can store moneytary values from -922,337,203,685,477.5808 to 922,337,203,685,477.5807 8 Bytes

SQL Approximate Numeric Data Types

In sql, Approximate numeric data types are used to store a numeric data with floating point i.e. floating point data is approximate therefore not all values in the data type range can be represented exactly.

 

Data TypeDescriptionStorage Size
Float(n) We can store values from - 1.79E 308 to 1.79E 308 Depends on value of n
real We can store values from - 3.40E 38 to 3.40E 38 4 Bytes