T-SQL Example code: Data Types
The various datatypes:
Name | data type | values | max |
---|---|---|---|
bigint | Integer | value (-9,223,372,036,854,775,808 – 9,223,372,036,854,775,807) | 2^63 |
int | smaller Integer | value (-2,147,483,648) – (2,147,483,647) | 2^31 |
smallint | smaller Integer | value (-32,768) – (32,767) | 2^15 |
tinyint | smaller Integer | values 0 – 255 | 2^8 |
bit | Integer data | value (either 1 or 0 value) | 1 or 0 |
decimal | Decimal | values from -10^38 – 10^38 | 10^38 |
numeric | Decimal | values from -10^38 – 10^38 | 10^38 |
money | Money | values (-922,337,203,685,477.5808) – (922,337,203,685,477.5807) | 2^63 |
smallmoney | Smaller Money | Values (-214,748.3648) – (214,748.3647) | 2^31 |
datetime | Date | value (January 1, 1753) – (December 31, 9999) | |
smalldatetime | Smaller Date | Value (January 1, 1900) – (June 6, 2079) | |
timestamp | Unique Number | Value (updates when row is updated) | |
char | Character String | Value (max 8,000 characters) | |
varchar | Character String | Value maximum of 8,000 characters, unless otherwise noted) | |
nchar | Character String | Value (max 4,000 characters) | |
nvarchar | Character String | Value (max 4,000 characters) | |
text | Character String | Value (max 2,147,483,647 characters) | 2^31 |
ntext | Character String | Value (max 1,073,741,823 characters) | 2^30 |
binary | Binary | Value (max 8,000 bytes) | |
varbinary | Binary | Value (max 8,000 bytes) | |
image | Binary | Value (max 2,147,483,647 bytes) | 2^31 |
uniqueidentifier | Global Unique ID | (GUID) |
Posted on July 12, 2012 at 14:08 by simon · Permalink
In: SQL · Tagged with: bigint, data type, datatype, datatypes, datetime, int, nvar, sql, var, varvhar
In: SQL · Tagged with: bigint, data type, datatype, datatypes, datetime, int, nvar, sql, var, varvhar