Collections:
Single-Byte Character Data Types in SQL Server Transact-SQL
What are single-byte character string data types supported in SQL Server Transact-SQL?
✍: FYIcenter.com
Single-byte character string data types are used to hold single-byte character strings.
There are 3 single-byte character string data types supported in SQL Server Transact-SQL:
1. CHAR (or CHARACTER) - Used to hold single-byte character strings of a fixed length specified in the format of CHAR(n), where n defines the string length as number of characters. The maximum length of CHAR is 8,000 single-byte characters.
The storage size of CHAR(n) is fixed to n bytes, regardless of the length of the string value.
2. VARCHAR (or CHAR VARYING, or CHARACTER VARYING) - Use to hold ASCII character strings of variable lengths specified in the format of VARCHAR(n), where n defines the string length as number of characters. The maximum length of VARCHAR is 8,000 single-byte characters.
The storage size of VARCHAR(n) is flexible up to n+2 bytes, depending on the length of the string value. The extra 2 bytes are used to store the length of the string value.
3. TEXT (or VARCHAR(MAX)) - Use to hold single-byte character strings of very large lengths. TEXT uses the CLOB (Character Large OBject) technology to store string values. TEXT can store string values of variable lengths up to 2^31-1 (2,147,483,647) characters.
Here are some good examples of single-byte character string values:
PRINT 'Hello! '; -- CHAR(10) PRINT 'Hello!'; -- VARCHAR(10)
⇒ Unicode Character Data Types in SQL Server Transact-SQL
⇐ Out-of-Range DATETIME Values in SQL Server Transact-SQL
2017-04-08, 3812🔥, 0💬
Popular Posts:
How To Update Multiple Rows with One UPDATE Statement in SQL Server? If the WHERE clause in an UPDAT...
Can Date and Time Values Be Converted into Integers in SQL Server Transact-SQL? Can date and time va...
How to set the current database in SQL Server? Once you are connected to the SQL Server, you should ...
How To Run SQL Commands in SQL*Plus in Oracle? If you want to run a SQL command in SQL*Plus, you nee...
How To Disable a Login Name in SQL Server? If you want temporarily disable a login name, you can use...