user2927086 user2927086 - 26 days ago 15
SQL Question

SQL Server is not numeric and not null

select CustomerName from CUSTOMER_TABLE where CustomerId IS NOT NULL


How can I get customer name if customer name is not numeric in SQL?

I tried to use
IS NOT NUMERIC
, I get syntax error.

So how can I do this?

Answer

Try with ISNUMERIC()

like

SELECT CustomerName FROM CUSTOMER_TABLE 
  WHERE CustomerId IS NOT NULL AND ISNUMERIC(CustomerName) = 0

ISNUMERIC() determines whether an expression is a valid numeric type or not.

Syntax is

ISNUMERIC ( expression )
Comments