Cast as Text or Int based on data

data .. issue ...

CASE WHEN mfgi.ITMREF_0 NOT LIKE '%[^0-9]%'
data could be like this '123 45' with spaces

which is going to the ELSE part
ELSE CAST (mfgi.ITMREF_0 AS INT) END'

but the data that is coming cannot be cast as int ...
'123 45' cannot be cast as int because of spaces
so error thrown

hope this explanation helps !!!!!! :slight_smile: :slight_smile:

1 Like