Multiple choice technology databases

Which data type would you use to store up to 2 GB of text data and still be able to query and manipulate it by using standard functions and operators?

  1. (a) Text

  2. (b) Varbinary

  3. (c) Varchar(max)

  4. (d) Varchar

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

VARCHAR(max) is the correct data type for storing up to 2 GB of text in SQL Server 2005. The TEXT data type is deprecated and doesn't support standard string functions and operators directly - you need to use READTEXT/WRITETEXT. VARCHAR(max) allows you to use all standard string functions and operators. VARCHAR without (max) has a maximum of 8000 characters. VARBINARY(max) is for binary data, not text.

AI explanation

varchar(max) is correct — introduced in SQL Server 2005 specifically to replace the legacy text type, varchar(max) can store up to 2GB of character data while still supporting standard string functions and operators (LIKE, SUBSTRING, +, etc.) that the old text type didn't fully support without special handling. Plain text is the deprecated large-object type with limited function support. varbinary stores binary (non-character) data, not text. Plain varchar (without max) is capped at 8,000 bytes, far short of 2GB.