Tuesday, April 30, 2013

READTEXT in T-SQL (SS2012)

This statement use to read text, ntext, or image values from a text, ntext, or image column, starting from a specified offset and reading the specified number of bytes.
Parameters of statement


  • table.column
Is the name of a table and column from which to read. Table and column names must
comply with the rules for identifiers. Specifying the table and column names is required;
however, specifying the database name and owner names is optional.

  • text_ptr
Is a valid text pointer. text_ptr must be binary(16).

  • Offset
Is the number of bytes (when the text or image data types are used) or characters
(when the ntext data type is used) to skip before it starts to read the text, image, or
ntext data.

  • Size
Is the number of bytes (when the text or image data types are used) or characters
(when the ntext data type is used) of data to read. If size is 0, 4 KB bytes of data is
read.

  • HOLDLOCK
Causes the text value to be locked for reads until the end of the transaction. Other
Users can read the value, but they cannot modify it.