Creating a text search index on binary data types

When creating a text search index, you have the option of specifying a code page for a binary column. Doing so helps the Db2® Text Search engine identify the character encoding.

About this task

To specify the code page when creating the text search index, use the following command:
	db2ts "CREATE INDEX index-name FOR TEXT ON table-name  
	CODEPAGE code-page"
When you store data in a column having a binary data type, such as BLOB or FOR BIT DATA, the data is not converted. This means that the documents retain their original code pages, which can cause problems when you create a text search index because you might have two different code pages. Therefore, you need to determine whether you are using the code page of the database or the code page specified for the db2ts CREATE INDEX command. If you do not know which code page was used to create the text search index, you can find out by issuing the following statement:
	db2 "SELECT CODEPAGE FROM SYSIBMTS.TSINDEXES where INDSCHEMA='schema-name' 
	and INDNAME='index-name'"