SQL Server, where field is int?

前端 未结 6 408
时光说笑
时光说笑 2021-01-18 04:20

how can I accomplish:

select * from table where column_value is int

I know I can probably inner join to the system tables and type tables b

6条回答
  •  时光说笑
    2021-01-18 05:10

    Why not use the following and test for 1?

    DECLARE @TestValue nvarchar(MAX)
    SET @TestValue = '1.04343234e5'
    
    SELECT CASE WHEN ISNUMERIC(@TestValue) = 1
            THEN CASE WHEN ROUND(@TestValue,0,1) = @TestValue
                THEN 1
                ELSE 0
                END
            ELSE null
            END AS Analysis
    

提交回复
热议问题