a KnowledgeBase blog for my random thoughts and observations...
Tuesday, July 30, 2013
T-SQL check for Integer value
declare @string as varchar(20)
set @string = '1.01'
select 'test' as col1, case WHEN ISNUMERIC(@string) = 0THEN 0 WHEN @string LIKE '%[^-+ 0-9]%' THEN 0 WHEN CAST(@string AS NUMERIC(38, 0)) NOT BETWEEN -2147483648. AND 2147483647. THEN 0 ELSE 1 end as intCol
No comments:
Post a Comment