teradatateradatasql

number pattern matching in Teradata


I was trying to get the rows matched with a pattern by using like in Teradata

select * from table_name where col_name like '10%';

here I wanted to get all the rows with column values like 1000, 101, 109, 1048 this is showing me error:

*** Failure 3544 Partial string matching requires character operands. Statement# 1, Info =0


Solution

  • You may first cast your numeric column to VARCHAR and then do the LIKE comparison:

    SELECT *
    FROM table_name
    WHERE CAST(col_name AS VARCHAR(30)) LIKE '10%';