• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 263
  • Last Modified:

Stored Proc Error with Isnumeric

IF (    (NOT ISNUMERIC(LEFT(@newExceptionLbl, 1))) AND (NOT ISNUMERIC(RIGHT(@newExceptionLbl, 1)))      )

I get this error:
Server: Msg 170, Level 15, State 1, Procedure test_put, Line 100 Line 100: Incorrect syntax near ')'.

Anything wrong with this statement?
0
phunchak
Asked:
phunchak
  • 2
1 Solution
 
Brendt HessSenior DBACommented:
IsNumeric returns 1 or 0.  Try this, instead of using NOT:

 IF (ISNUMERIC(LEFT(@newExceptionLbl, 1))=0)
     AND (ISNUMERIC(RIGHT(@newExceptionLbl, 1))=0)
0
 
Brendt HessSenior DBACommented:
The NOT syntax you are using is from languages like VB, where NOT TRUE = FALSE, and only works on Boolean operations.  IsNumeric does not return a Boolean, but an INT.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now