IF Condition failing because ISNUMERIC Expression Not evaluating properly

Occasional Visitor

Greetings. I have an IF Condition going down the wrong path as the code isn't evaluating an isnumeric condition as expected. I have debugged it in VStudio and see the following. I have a Substring that pulls a value out of a note. When I hover over @result in either statement, I see 36 which is expected. When I hover over @variabletest, it evaluates to 0 and the next If statement is evaluated where it should be skipped. Why would @variabletest evaluate to 0 if @result was 36?

 

Basically, I am searching anumber of locations for a number value in different tables and I want the process to stop as soon as I get a number (isnumeric(@result = 1). Any advice would be appreciated

 

Set @variabletest = isnumeric(@result)
If @result is null or @result = ''or @variabletest <> 1

1 Reply

Hi @Daryl1050 

 

in order to reproduce your scenario please provide

 

1) Queries to CREATE your table(s) including indexes
2) Queries to INSERT sample data.
3) The desired result given the sample, as text or image of excel for example.
4) A short description of the business rules, and how you got 1-2 of the results
5) Which version of SQL Server you are using (this will help to fit the query to your version).

 

Regards,