Reputation: 101
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?
Upvotes: 8
Views: 79709
Reputation: 7678
Try with ISNUMERIC()
For example, from your query
SELECT CustomerName FROM CUSTOMER_TABLE
WHERE CustomerId IS NOT NULL AND ISNUMERIC(CustomerName) = 0
ISNUMERIC(expr.) determines whether an expression is a valid numeric type or not.
Syntax:
ISNUMERIC ( expression )
Upvotes: 37
Reputation: 460258
The function's name is ISNUMERIC
:
SELECT CustomerName
FROM CUSTOMER_TABLE
WHERE CustomerId IS NOT NULL
AND ISNUMERIC( CustomerName ) = 0
Upvotes: 10