Selecting text and image Values

You can use either the SELECT or READTEXT statement to select values that have the text or image datatypes.

When the select list includes text and image values, the limit on the length of the data returned depends on the setting of the @@TEXTSIZE global variable. This value (in bytes) is changed with the SET statement TEXTSIZE option, as shown here:

SET TEXTSIZE 25

The default setting for TEXTSIZE is 4096 (4K).

With a TEXTSIZE setting of 25, a SELECT statement that includes a text column displays only the first 25 characters of the data, as shown here:

SELECT pub_id, pr_info
FROM pub_info

pub_id pr_info                                                                                                                                                                                                                                          
-------------------------------
0736   This is sample text data
0877   This is sample text data
1389   This is sample text data
1622   This is sample text data
1756   This is sample text data
9901   This is sample text data
9952   This is sample text data
9999   This is sample text data

(8 row(s) affected)

After trying this example, reset TEXTSIZE to its default value, using the following statement:

SET TEXTSIZE 0

The default display is the actual length of the data when its size is less than TEXTSIZE.

Note When you are selecting image data, the returned value includes the characters 0x, which indicate that the data is hexadecimal. These two characters are counted as part of TEXTSIZE.