SQL Data Type is a specified attribute for any object's data type. There is an associated data type in SQL in each column, variable and expression. When designing your tables, you can use various types of data, and you can select a data type based on your requirements for a table column.
SQL Server provides six data types categories, described below –
DATA TYPE |
---|
bigint |
int |
smallint |
tinyint |
bit |
decimal |
numeric |
money |
smallmoney |
DATA TYPE |
---|
float |
real |
DATA TYPE |
---|
datetime |
smalldatetime |
date |
time |
Sr.No | DATA TYPE & Description |
---|---|
1 | char 8,000 characters of maximum length. (Non-Unicode characters with fixed length) |
2 | varchar Maximum 8,000 characters of varchar. (Non-Unicode data variable-length) |
3 | varchar(max) 2E + 31 characters maximum, non-Unicode data variable-length (SQL Server 2005 only). |
4 | text Non-Unicode variable length data of 2 147,483,647 characters for a maximum length. |
Sr.No | DATA TYPE & Description |
---|---|
1 | nchar Max length = 4,000 characters |
2 | nvarchar Max length = 4,000 characters |
3 | nvarchar(max) Max length = 2E + 31 characters |
4 | ntext Max length = 1,073,741,823 characters |
Sr.No | DATA TYPE & Description |
---|---|
1 | Binary Up to 8,000 bytes Length (Fixed-length binary data ) |
2 | varbinary 8,000 bytes of maximum length. (Binary data for variable length) |
3 | varbinary(max) 2E Plus 31 bytes maximum length (SQL Server 2005 only). (Binary data for variable length) |
4 | image Most 2.147.483.647 bytes of length. (Binary Data variable length) |
Sr.No | DATA TYPE & Description |
---|---|
1 | sql variant Stores values of several types of data provided by SQL Server, with the exception of text, ntext and time signs. |
2 | Timestamp Specifies a unique database number that is updated each time a row is updated. |
3 | Unique identification Store a global unique xml GUID Store XML Data. |
4 | xml xml instances can be stored in a column or a variable (SQL Server 2005 only). |
5 | cursor Reference to a cursor object |
6 | table Stores a result set for later processing |
|