textptr

Description

Returns a pointer to the first page of a text or image column.

Syntax

textptr(column_name)

Parameters

column_name

is the name of a text column.

Examples

Example 1

Uses the textptr function to locate the text column, copy, associated with au_id 486-29-1786 in the author’s blurbs table. The text pointer is put into a local variable @val and supplied as a parameter to the readtext command, which returns 5 bytes, starting at the second byte (offset of 1):

declare @val binary(16) 
    select @val = textptr(copy) from blurbs
    where au_id = "486-29-1786"
    readtext blurbs.copy @val 1 5

Example 2

Selects the title_id column and the 16-byte text pointer of the copy column from the blurbs table:

select au_id, textptr(copy) from blurbs

Usage

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

Any user can execute textptr.

See also

Datatypes text and image datatypes

Functions textvalid

Commands insert, update, readtext, writetext