Tam Tran Tam Tran - 1 month ago 9
SQL Question

isnumeric function

I have table with data a mixture of alpha and numeric, I'm trying to find the way to extract value only if it's numeric

PSDcode2:
========
631302
631308
631309
631301
STATE
STATE
ON TWP


My select statement will work just fine, but I just is there better way of doing this? thanks

case when PS.PSDcode2 in (' STATE','ON TWP') then 'NULL' else PS.PSDcode2 end as PSDcode2,

Answer

I will go with NOT LIKE approach it works well for any data

Select * [Table_Name] WHERE PSDcode2 NOT LIKE '%[^0-9]%'
Comments