What Are Character String Data Types in MS SQL Server?
Submitted by: AdministratorCharacter string data types are used to store code page based character strings. SQL Server 2005 supports the following character string data types:
* CHAR - Code page based character strings with a fixed length of n bytes defined as CHAR(n). The maximum length is 8,000 bytes. CHAR has a synonym of CHARACTER.
* VARCHAR - Code page based character strings with a variable length of n bytes defined as VARCHAR(n). The maximum length is 8,000 bytes. VARCHAR has two synonyms of CHAR VARYING and CHARACTER VARYING. VARCHAR also has special form as VARCHAR(MAX), which can store up to 2^31-1 bytes.
* TEXT - Code page based character strings with a variable length up to 2^31-1 (2,147,483,647) bytes. TEXT is equivalent to VARCHAR(MAX).
Here are some good examples of character string values:
PRINT 'Hello! '; -- CHAR(10)
PRINT 'Hello!'; -- VARCHAR(10)
GO
Submitted by: Administrator
* CHAR - Code page based character strings with a fixed length of n bytes defined as CHAR(n). The maximum length is 8,000 bytes. CHAR has a synonym of CHARACTER.
* VARCHAR - Code page based character strings with a variable length of n bytes defined as VARCHAR(n). The maximum length is 8,000 bytes. VARCHAR has two synonyms of CHAR VARYING and CHARACTER VARYING. VARCHAR also has special form as VARCHAR(MAX), which can store up to 2^31-1 bytes.
* TEXT - Code page based character strings with a variable length up to 2^31-1 (2,147,483,647) bytes. TEXT is equivalent to VARCHAR(MAX).
Here are some good examples of character string values:
PRINT 'Hello! '; -- CHAR(10)
PRINT 'Hello!'; -- VARCHAR(10)
GO
Submitted by: Administrator
Read Online MS SQL Server Job Interview Questions And Answers
Top MS SQL Server Questions
☺ | How To Select Some Specific Rows from a Table in MS SQL Server? |
☺ | How To Start SQL Server Browser Service? |
☺ | How To Execute the Cursor Queries with "OPEN" Statements? |
☺ | How To Test ODBC DSN Connection Settings? |
☺ | PHP MSSQL - How To Display a Past Time in Days, Hours and Minutes? |
Top Databases Programming Categories
☺ | RDBMS Interview Questions. |
☺ | SQL Interview Questions. |
☺ | SSRS Interview Questions. |
☺ | Database Administrator (DBA) Interview Questions. |
☺ | Sybase Interview Questions. |