Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Black_Hole
Creator II
Creator II

Using IsNum in SQL SELECT

Hello all,

When I run my script I have an error in the following lines in particular:

SQL SELECT *

FROM Table_Cus

WHERE SUBSTRING(NUM_CUS,1,1)='S' AND ISNUMERIC(SUBSTRING(NUM_CUS,2,LEN(NUM_CUS)-1));

In attached file, I screened the detail of my error.

Please could you help me to identify what's wrong in my where clause.

Thank you in advance for your help.

Capture.PNG

Labels (2)
1 Solution

Accepted Solutions
Anil_Babu_Samineni

Can i convert this to Qlik, If so - Here u go?

Load * Where Mid(NUM_CUS,1,1)='S' AND ISNUM(Mid(NUM_CUS,2,LEN(NUM_CUS)-1));
SQL SELECT * FROM Table_Cus

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

3 Replies
Anil_Babu_Samineni

Can i convert this to Qlik, If so - Here u go?

Load * Where Mid(NUM_CUS,1,1)='S' AND ISNUM(Mid(NUM_CUS,2,LEN(NUM_CUS)-1));
SQL SELECT * FROM Table_Cus

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
peterwh
Creator II
Creator II

Hello,

in the error message I see, that you're using a DB2 database. I've made a search on "Db2 for i SQL reference" and it seems there is no "Isnumeric" function.

On "www.experts-exchange.com" I found the following solution, maybe this will help you:

you can use the translate function and translate each numeric character to blank,
then use trim and check if you get the empty string
for example

select ....
from
where rtrim(ltrim(translate(your_string,' ','1234567890'))) = ''

Kind regards

Peter

 

 

Black_Hole
Creator II
Creator II
Author

Hello @Anil_Babu_Samineni , @peterwh ,

Thank you both for your help.

@Anil_Babu_Samineni :  I try it and it's run successfully.

@peterwh :  I understand why  sometimes there are functions which are not identified in my QVW. I will consider the connection when I will use the functions implemented in QVW.