Showing posts with label IsDate. Show all posts
Showing posts with label IsDate. Show all posts

Wednesday, July 8, 2009

IsNumeric command

No worries, the virtual table below creates the data set and so no data tables are needed to run this query. . . .

Select
TestVariable = case when isnumeric(org.OrderAmountRangeQty)= 0 then org.OrderAmountRangeQty
else 'Its a number' end
from
(
Select OrderAmountRangeQty = 'Z'
union all
Select OrderAmountRangeQty = '1'
union all
Select OrderAmountRangeQty = '15'
union all
Select OrderAmountRangeQty = '#2'
union all
Select OrderAmountRangeQty = '3'
) as org
-- isnumeric(column) = 0 means it's not a number
-- isnumeric(column) = 1 means the column value IS a number

Similar functions: IsDate identifies if the freetext field is a date.