A.11. Text and Image Functions

The text and image functions perform operations on text or image data. They are:

  • PATINDEX (This was covered in the "String Functions" section earlier in the appendix.)

  • TEXTPTR

  • TEXTVALID

A.11.1. TEXTPTR

The TEXTPTR function checks the value of the text pointer that corresponds to a text, ntext, or image column and returns a varbinary value. The text pointer should be checked to ensure that it points to the first text page before running READTEXT, WRITETEXT, and UPDATE statements. The syntax is as follows:

TEXTPTR(<column>)

A.11.2. TEXTVALID

The TEXTVALID function checks whether a specified text pointer is valid. The syntax is as follows:

TEXTVALID('<table.column>', <text_ptr>)

The table.column parameter specifies the name of the table and column to be used. The text_ptr parameter specifies the text pointer to be checked.

This function will return 0 if the pointer is invalid and 1 if the pointer is valid.

Get Professional SQL Server™ 2005 Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.