Is there an sql condition that can look for non integers in a column?

前端 未结 2 1019
南方客
南方客 2021-02-07 06:00

Basically I would like a select statement that would function like this

SELECT *
FROM table  
WHERE column IS NOT INT  

Is there a condition li

2条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-07 06:23

    In SQL Server you can do:

    SELECT  *
    FROM    mytable  
    WHERE   CASE WHEN IsNumeric(mycolumn) = 1 THEN CASE WHEN CAST(mycolumn AS FLOAT) <> CAST(CAST(mycolumn AS FLOAT) AS INT) THEN 1 END ELSE 1 END = 1
    

提交回复
热议问题