Wednesday, January 4, 2017

                                      String Datatypes

The following are the String Datatypes in SQL Server (Transact-SQL):

Data Type Syntax

Maximum     Size    

                            Explanation

CHAR(size)

Maximum size of 8,000 characters.

Where size is the number of characters to store. Fixed-length. Space padded on right to equal size characters. Non-Unicode data.

VARCHAR(size) or VARCHAR(max)

Maximum size of 8,000 or max characters.

Where size is the number of characters to store. Variable-length. If max is specified, the maximum number of characters is 2GB. Non-Unicode data.

TEXT

Maximum size of 2GB.

Variable-length. Non-Unicode data.

NCHAR(size)

Maximum size of 4,000 characters.

Fixed-length. Unicode data.

NVARCHAR(size) or NVARCHAR(max)

Maximum size of 4,000 or max characters.

Where size is the number of characters to store. Variable-length. If max is specified, the maximum number of characters is 2GB. Unicode data.

NTEXT

Maximum size of 1,073,741,823 bytes.

Variable length. Unicode data.

BINARY(size)

Maximum size of 8,000 characters.

Where size is the number of characters to store. Fixed-length. Space padded on right to equal size characters. Binary data.

VARBINARY(size) or VARBINARY(max)

Maximum size of 8,000 or max characters.

Where size is the number of characters to store. Variable-length. If max is specified, the maximum number of characters is 2GB. Non-Binary data.

IMAGE

Maximum size of 2GB.

Variable length . Binary data.

No comments:

Post a Comment