Search code examples
sqldb2full-text-search

How can I create a DB2 Full Text Index through SQL?


I'd like to create a full-text index on DB2 through SQL, I want to run it remotely as I won't have access to the server but I've run into a few problems.

I don't have control over the casing of the schema, so the following:

CALL SYSPROC.SYSTS_CREATE('my_schema_name', 'my_index_name', 'my_table (my_column)', '', 'en_us', ?)

Won't work as it interprets 'my_schema_name' as MY_SCHEMA_NAME. I've tried using:

'"my_schema_name"' but this throws an error:

The command failed because of an unexpected token. Un"

I understand good/bad practice with schema/object names, but it needs to support lowercase schema names, and every other thing seems to work.


Solution

  • I was missing the schema in the table name:

    CALL SYSPROC.SYSTS_CREATE('my_schema_name', 'my_index_name', 'my_schema_name.my_table (my_column)', '', 'en_us', ?)

    Works as expected.