[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
RE: [sqr-users] How to check 'CHAR' field to find outifitcontainsall Numeric?
- Subject: RE: [sqr-users] How to check 'CHAR' field to find outifitcontainsall Numeric?
- From: "Tajinder Chahal" <Tchaha@Roushind.com>
- Date: Fri, 15 Oct 2004 08:41:38 -0400
- Cc:
- Delivery-date: Fri, 15 Oct 2004 07:45:11 -0500
- List-id: "This list is for discussion about the SQR database reportinglanguage from Hyperion Solutions." <sqr-users.sqrug.org>
I checked my code again and ran the sql and I think I'm right. The correct way
in DB2 is translate($string,'','0123456789). If it returns a blank that means
it is all numeric.
May be database or version of database makes the difference.
>>> JHarris@frederick.edu 10/14/04 05:10PM >>>
Actually, I think Kevin is right. Kevin's way returns the correct output, but
your way seems to always say the string contains letters.
The code below shows this as the output:
-------------
Kevin's way
-------------
123124 All numeric
ABCDEF Contains non-numeric characters
-------------
Tchaha's way
-------------
123124 Contains non-numeric characters
ABCDEF Contains non-numeric characters
Here is the code:
show '-------------'
show 'Kevin''s way'
show '-------------'
let $string = '123124'
show $string noline
if $string <> '' and translate($string, '0123456789', '') = ''
show ' All numeric'
else
show ' Contains non-numeric characters'
end-if
let $string = 'ABCDEF'
show $string noline
if $string <> '' and translate($string, '0123456789', '') = ''
show ' All numeric'
else
show ' Contains non-numeric characters'
end-if
show '-------------'
show 'Tchaha''s way'
show '-------------'
let $string = '123124'
show $string noline
if $string <> '' and translate($string, '','0123456789') = ''
show ' All numeric'
else
show ' Contains non-numeric characters'
end-if
let $string = 'ABCDEF'
show $string noline
if $string <> '' and translate($string, '','0123456789') = ''
show ' All numeric'
else
show ' Contains non-numeric characters'
end-if
-----------------------------------------------------
James Harris
Junior Systems Programmer/Analyst
Information Technology Division
Frederick Community College
-----------------------------------------------------
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users