DATETIME SELECT SELECT INTO DATE PAD STRING DYNAMIC SQL CURSOR MONEY FORMAT PERCENT STORED PROCEDURE SQL SERVER AGENT JOB OPTIMIZATION WHILE LOOP OVER PARTITION BY UPDATE
SITE SEARCH SQLUSA.com HEADLINES NEWS
SQL E/BOOKS   SQL 2014 PROGRAMMING   DOWNLOADS
SCRIPTS SQL 2005 SQL 2008 ARTICLES
SQL JOBS TWITTER FORMAT VIDEOS
How to use READTEXT for text reading?

Execute the following SQL Server T-SQL example scripts in SSMS Query Editor demonstrate the reading segments of a text string.

-- SQL Server readtext - SQL Server textptr

USE pubs;

DECLARE  @p VARBINARY(16) -- pointer to text

 

SELECT @p = TEXTPTR(pr_info)

FROM   pub_info pr

       INNER JOIN publishers p

         ON pr.pub_id = p.pub_id

WHERE  p.pub_name = 'Five Lakes Publishing'

 

READTEXT pub_info.pr_info @p 0 256;

/*

pr_info

This is sample text data for Five Lakes Publishing, publisher 1622 in the

pubs database. Five Lakes Publishing is located in Chicago, Illinois.   

This is sample text data for Five Lakes Publishing, publisher 1622

in the pubs database. Five Lakes Publishin

*/

 

-- Reading 4 bytes at a time starting with offset 120

READTEXT pub_info.pr_info @p 120 4;

/*

pr_info

d in

*/

 

READTEXT pub_info.pr_info @p 124 4;

/*

pr_info

 Chi

*/

 

READTEXT pub_info.pr_info @p 128 4;

/*

pr_info

cago

*/

 

READTEXT pub_info.pr_info @p 132 4;

/*

pr_info

, Il

*/

 

READTEXT pub_info.pr_info @p 136 4;

/*

pr_info

lino

*/

 


Exam Prep 70-461
Exam 70-461
DATETIME SELECT SELECT INTO DATE PAD STRING DYNAMIC SQL CURSOR MONEY FORMAT PERCENT STORED PROCEDURE SQL SERVER AGENT JOB OPTIMIZATION WHILE LOOP OVER PARTITION BY UPDATE