USE pubs
GO
DECLARE @ptrval varbinary(16)
SELECT @ptrval = TEXTPTR(pr_info)
FROM pub_info pr INNER JOIN publishers p
ON pr.pub_id = p.pub_id
AND p.pub_name = 'New Moon Books'
READTEXT pub_info.pr_info @ptrval 1 25
GO
Is the name of a table and column from which to read. Table and column names must conform to 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 using the text or image data types) or characters (when using the ntext data type) to skip before starting to read the text, image, or ntext data. When using ntext data type, offset is the number of characters to skip before starting to read the data. When using text or image data types, offset is the number of bytes to skip before starting to read the data.
size
Is the number of bytes (when using the text or image data types) or characters (when using the ntext data type) of data to read. If size is 0, 4 KB bytes of data are 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.
---------------------------------
DECLARE @ptrval varbinary(16)
SELECT @ptrval = TEXTPTR(pr_info)
FROM pub_info pr INNER JOIN publishers p
ON pr.pub_id = p.pub_id
AND p.pub_name = 'New Moon Books'
READTEXT pub_info.pr_info @ptrval 1 25