sql - Set Values in column B based on values in Column A in SQL2005? -
i'm trying take existing column , parse each row words in string, i.e. sheet, page, card, , based on word (only 1 instance of 1 of these words in row) populate new column in same table value. if did not find of words, leave column b blank.
i.e. column contains word "sheet", populate column b letter "s"
so table like:
column column b sheet s page p card c
any appreciated!
update yourtable set columnb = case when columna '%sheet%' 's' when columna '%page%' 'p' when columna '%card%' 'c' else null /* or '' if prefer */ end
Comments
Post a Comment