Question

I need to find a way to search all columns along these lines:

select CASE 
            When substr(column,1,7) = 'Report:' then substr(column,8)
            when substr(column,1,5) = 'Print' then substr(column, 6)
        else column
        end
  from table

Any help on syntax and what not would be greatly appreciated!

Was it helpful?

Solution

Edit column when selected based on content

Are you looking for this?

UPDATE table
SET 
    column = 
        CASE 
            WHEN substr(column,1,7) = 'Report:' THEN substr(column,8)
            WHEN substr(column,1,5) = 'Print' THEN substr(column, 6)
            ELSE column
        END
WHERE <conditions>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top