Page 1 of 1

DB2 query to check the low values.

Posted: Mon Jan 18, 2016 12:31 pm
by AnsulMainframe
Hi,

I have a table called 'STATUSTABLE' with columns TName - Profile name of user and TStatus - Status of user. TName is CHAR and TStatus is VARCAR.
I need a SQL query to fetch those TNames with TStatus containing low values. When a status contains low values in BETWEEN as like below.

Code: Select all

Text - WHAT A GREAT MORNING!! 
it becomes a problem.

Re: DB2 query to check the low values.

Posted: Mon Jan 18, 2016 2:37 pm
by William Collins
It is really unclear what you are asking.

Since binary-zeros don't display too well, can you indicate where they are in the data with a 0, please?

In your example, which is TName and which is TStatus?

Which problem are you getting with the binary-zero, are you using DB2 for z/OS or something else?

Re: DB2 query to check the low values.

Posted: Thu Jan 21, 2016 10:29 am
by Chandan Yadav
Hi,

Try this

Code: Select all

SELECT TNAME
  FROM STATUSTABLE
WHERE LOCATE(X'00',TSTATUS) > 1
This is untested but should work.

Thanks and regards,
Chandan