How can I use underscores in "LIKE" conditions in Tivoli? [duplicate]

StackOverflow https://stackoverflow.com/questions/16482463

  •  21-04-2022
  •  | 
  •  

سؤال

I can't properly use underscores in the LIKE part when I use Tivoli databases.

I connected to a Tivoli database with AQT and just run this query;

select NODE_NAME from NODES where NODE_NAME like '%_SQL'

This query gets as result;

AKHEDEFSRV_SQL
AKHEDEF_SQL
AKLSFS_SQLPAKL1_SQL
AKLSFS_SQLPAKL2_SQL

But also gets

AKLSPRODSQL
AKLSTESTSQL

It looks to me as if Tivoli ignores the underscore in the LIKE part of the query. Anyone has an idea?

هل كانت مفيدة؟

المحلول

The underscore matches a single character, unless it is escaped. Try:

select NODE_NAME from NODES where NODE_NAME like '%__SQL' escape '_'
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top