Data Types in SQL Server

Data Type
Description
Remarks
BIGINT
Used for large Integer data.(Range -2^63  to 2^63-1)
It takes 8 Bytes
INT
Primary integer type for SQL server(-2^31 to 2^31-1)
4 Bytes
SMALLINT
-2^15 to 2^15-1
2 Bytes
TINYINT
0 to 255
1 Byte
NUMERIC(P,S)
Ex: numeric(5,2) Here maximum 5 precision and 2 is scale.-10^38 to 10^38-1
5 to 17 bytes
DECIMAL(P,S)
.-10^38 to 10^38-1
5 to 17 bytes
BIT
Can be 0, 1 or NULL. String values TRUE, FALSE can be converted as 1, 0 respectively.

DATETIME
Date and time data from January 1, 1753, through December 31, 9999, with an accuracy of three-hundredths of second or 3.33 milliseconds.

SMALLDATETIME
 Date and time data from January 1, 1900, through June 6, 2079, with an accuracy of one minute.

CHAR(N)
Fixed-length non-Unicode character data with a maximum length of 8,000 characters.

VARCHAR(N)
Variable-length non-Unicode data with a maximum of 8,000 characters.

NCHAR
 maximum length of 8,000 characters

NVARCHAR
maximum length of 4,000 characters

NTEXT
maximum length of 2^30 - 1 (1,073,741,823) characters

Binary
Use to store Fixed-length binary data with a maximum length of 8,000 bytes

varbinary
Use to store Variable-length binary data with a maximum length of 8,000 bytes

Image
Use to store variable length binary data with a maximum of 2^31-1

Cursor
Have reference to cursor

sql_variant
A data type that stores values of various SQL Server-supported data types, except text, Ntext, timestamp, and sql_variant.

Table
A special datatype use to store resultset.

uniqueidentifier
A globally unique identifier (GUID).

See more details

SQL Server Data Types



Prev--->Defining Variables in T-SQL                                                              Next--->Control Statements 

No comments:

Post a Comment

Please leave a comment for this post