text, ntext, and image Data Types

SQL Server provides a solid foundation for building object-relational features. One SQL Server 7.0 enhancement is for text and image storage, which uses a new, efficient data structure.

The SQL Server 7.0 ntext, text, and image data types are capable of storing extremely large amounts of data (up to 2 GB) in a single value. A single data value is typically larger than can be retrieved in one step by an application; some values may be larger than the virtual memory available on the client. This means that special steps may be necessary to retrieve these values. If the value for these data types is no longer than a Unicode, character, or binary string (4,000 characters, 8,000 characters, or 8,000 bytes), the value can be referenced in SELECT, UPDATE, and INSERT statements much the same as smaller data types.

text, ntext, and image data type values are not stored as part of the data row but in a separate collection of pages. For each value, only a 16-byte pointer is stored. For each row, the pointer points to the location of data. A row containing multiple text, ntext, or image columns has one pointer for each column.

The data is stored in a collection of 8-KB pages that are not necessarily located next to each other. In SQL Server 7.0, the pages are organized logically in a B-tree structure. In earlier versions, they are linked in a page chain. The advantage of the B-tree structure is that operations starting in the middle of the string are more efficient, making the B-tree quicker to navigate. This is in contrast to page chains, which often take a somewhat random path through the files of a database. The structure of the B-tree differs slightly depending on whether there is more or less than 32 KB of data.