Data type |
Type |
Description |
Bit |
Integral type |
The bit data type is integral, and its value can only be 0, 1, or null. This data type is used to store data with only two possible values, such as Yes or No, True or false, on, or off |
Int |
Integral type |
The int data type can store integers from-2 (-2147483648) to 2 to (2147483 647). Almost all numeric data stored in a database can be used with this data type. This type of data occupies 4 bytes in the database. |
smallint |
Integral type |
The smallint data type can store integers from2 (-32768) to 2(32767). This data type is useful for storing numeric data that is often scoped to a specific range. This data type occupies 2 bytes of space in the database. |
tinyint |
Integral type |
The tinyint data type can store integers from 0 to 255. It is useful when you only intend to store a limited number of values. This data type occupies 1 bytes in a database |
Numeric |
Precise numerical type |
The numeric data type is the same as the decimal type |
Decimal |
Precise numerical type |
The decimal data type can be used tostore numeric data of fixedprecision and range from -10 to 1 to 1. When you use this data type, you must specify the range and precision. The range is the total number of digits that can be stored around the decimal point. Precision is the number of digits stored on the right of the decimal point |
Money |
Currency type |
The Money data type is used to denote monetary and currency values. This data type can store data from 922 billion to 922 billion, accurate to one out of 10,000 of the currency unit |
SmallMoney |
Currency type |
The smallmoney data type is used to represent money and currency values. This data type can store data from 214748.3648 to 214748.3647, accurate to one out of 10,000 of the currency unit |
Float |
Approximate numerical type |
The float data type is an approximate numeric type that is used by floating point numbers. It is said that the floating-point number is approximate, because not all the numbers in its range can be accurately represented. Floating-point numbers can be any number from -1.79E+308 to 1.79E+308 |
Real |
Approximate numerical type |
Real data types are approximate numeric types like floating-point numbers. It can represent a floating-point number between -3.40E+38 and 3.40E+38. |
Datetime |
Date-Time Type |
The datetime data type is used to represent the date and time. This data type stores all date and time data from January 1, 1753 to December 9999 3 1st, accurate to 1% seconds or 3.33 milliseconds |
smalldatetime |
Date-Time Type |
The smalldatetime data type is used to represent the date and time from January 1, 1900 to June 6, 2079, accurate to one minute |
Cursor |
Special Data type |
The cursor data type is a special type of data that contains a reference to a cursor. This data type is used in stored procedures and cannot be used when creating tables |
Timestamp |
Special Data type |
The timestamp data type is a special type of data that is used to create a database-wide unique digital. There can be only one timestamp column in a table. Each time you insert or modify a row, the value of the timestamp column changes. Although it has "time" in its name, the timestamp column is not a date that people can recognize. In a database, the timestamp value is unique. |
uniqueidentifier |
Special Data type |
The uniqueidentifier data type is used to store a globally unique identifier, the GUID. The GUID is truly globally unique. This number has little chance of being rebuilt in another system. You can initialize a column with a unique identifier by using the NEWID function or by converting a string to a unique identifier |
Char |
Character type |
The char data type is used to store fixed-length, non-uniform encoded data of specified lengths. When you define a column for this type, you must specify a column length. This data type is useful when you always know the length of the data you want to store. For example, when you store data by zip code plus 4 character formatting, you know that you always need to use 10 characters. This data type has a maximum width of 8,000 characters |
varchar |
Character type |
The varchar data type, like the char type, is used to store non-uniform encoded character data. Unlike the char type, this data type is variable length. When you define a column for that data type, you specify the maximum length of the columns. The biggest difference to the char data type is that the length of the store is not a column long, but the length of the data |
Text |
Character type |
The text data type is used to store a large number of non-uniform encoded character data. This data type can have a maximumof 2-1 or 2 billion characters |
NChar |
Unified coded Character type |
The nchar data type is used to store fixed-length, uniformly encoded character data. Uniform encoding uses a double-byte structure to store each character, rather than a single byte (in normal text). It allows for a large number of extended characters. This data type can store 4000 characters, increasing the byte space used by |
nvarchar |
Unified coded Character type |
The nvarchar data type is used as a uniformly encoded character type data that is variable length. This data type can store 4000 characters, using a byte space increase of one |
ntext |
Unified coded Character type |
The ntext data type is used to store a large number of uniformly encoded character-type data. This data type can store 2 -1 or nearly 1 billion characters, and the byte space used increases by one times |
Binary |
Binary data types |
Binary data types are used to store fixed-length binary data up to 8000 bytes long. You should use this data type when the contents of the input table are close to the same length |
varbinary |
Binary data types |
The varbinary data type is used to store variable-length binary data up to 8000 bytes long. You should use this data type when the content size of the input table is variable |
Image |
Binary data types |
The image data type is used to store variable-length binary data up to 2-1 or about 2 billion bytes |