SQL data type defines the type and range of the data that can be used with SQL Server.
Commonly used SQL data types:
| Data Type | Syntax | Description |
| integer | integer | Integer number. |
| smallint | smallint | Small integer number. |
| numeric | numeric(p,s) | Where p is a precision value; s is a scale value. For example, numeric(7,3) is a number that has 4 digits before the decimal and 3 digits after the decimal. |
| decimal | decimal(p,s) | Where p is a precision value; s is a scale value. |
| real | real | Single-precision floating point number |
| double precision | double precision | Double-precision floating point number |
| float | float(p) | Where p is a precision value. |
| character | char(x) | Where x is the number of characters to store. This data type is space padded to fill the number of characters specified. |
| character varying | varchar2(x) | Where x is the number of characters to store. This data type does NOT space pad. |
| bit | bit(x) | Where x is the number of bits to store. |
| bit varying | bit varying(x) | Where x is the number of bits to store. The length can vary up to x. |
| date | date | Stores year, month, and day values. |
| time | time | Stores the hour, minute, and second values. |
| timestamp | timestamp | Stores year, month, day, hour, minute, and second values. |
| time with time zone | time with time zone | Exactly the same as time, but also stores an offset from UTC of the time specified. |
| timestamp with time zone | timestamp with time zone | Exactly the same as timestamp, but also stores an offset from UTC of the time specified. |
Next Topic: SQL operators.
Previous Topic: SQL Syntax.