Skip to content

READTEXT

READTEXT { table.column text_ptr [ WITH LOCK ] [ { FIPS_FLAGGER [ OFF ] } ] [ size [ OFFSET start ] ] } [ HOLDLOCK ]]

Section titled “READTEXT { table.column text_ptr [ WITH LOCK ] [ { FIPS_FLAGGER [ OFF ] } ] [ size [ OFFSET start ] ] } [ HOLDLOCK ]]”
DECLARE @pointer binary(16)
SELECT @pointer = TEXTPTR(Resume)
FROM Applicants
WHERE ApplicantID = 1
READTEXT Applicants.Resume @pointer 0 50
"An accomplished software engineer specialized in object-or..."

In the example, READTEXT is used on the “Resume” column from the “Applicants” table. It reads the text, ntext, or image value - where the ID is 1 - from the offset 0 and for 50 bytes. The output is the first 50 bytes of the “Resume” field of the applicant with an ID of 1.