CASE
WHEN <in_data> LIKE '[0-9][0-9][0-9][0-9][0-9][0-9]' THEN SUBSTR(<in_data>,1,3)
ELSE '000'
END
We're doing a migration project from Sybase to Teradata, and having a problem figuring this one out :) I'm still new to Teradata.
I would like to ask the equivalent TD code for this - LIKE '[0-9][0-9][0-9][0-9][0-9][0-9]' to Teradata
Basically, it just checks whether the digits are numeric value. Can someone give me a hint on this
You need to use
regexp
instead oflike
, since[0-9][0-9][0-9][0-9][0-9][0-9]
is a regular expression.To do an exact match, you need to add anchors. ie, to match the string which contains an exact 6 digit chars.
or