7> CREATE TABLE pub_info
8> (
9> pub_id char(4) NOT NULL,
10> logo image NULL,
11> pr_info text NULL
12> )
13> GO
1>
2>
3> -- READTEXT with a protected text pointer
4> BEGIN TRAN
5> DECLARE @mytextptr varbinary(16), @sizeneeded int, @pat_offset int
6> SELECT @mytextptr=TEXTPTR(pr_info),
7> @pat_offset=PATINDEX('%Washington%',pr_info) - 1,
8> @sizeneeded=DATALENGTH(pr_info) -
9> (PATINDEX('%Washington%',pr_info) - 1)
10> FROM pub_info (HOLDLOCK) WHERE pub_id='0877'
11>
12> IF @mytextptr IS NOT NULL AND @pat_offset >= 0 AND
13> @sizeneeded IS NOT NULL
14> READTEXT pub_info.pr_info @mytextptr @pat_offset @sizeneeded
15>
16> GO
1>
2>
3> drop table pub_info;
4> GO
1>
5.19.READTEXT |
| 5.19.1. | READTEXT [[database.]owner.]table_name.column_name text_ptr offset size [HOLDLOCK] |