I am completely new to writing SQL scripts and could use a little help. I need to create a script that will run only once and add a column to an existing table. This column needs to have a value directly dependent to another column's value. The value is based on whether the other column's text value contains some text.
For instance, I need a way of saying for the following value "MNA-HLTH-CAR":
if (tableValue.contains("HLTH")) {
newColumn.insert("Health"); //Insert new column value Health
} else if (tableValue.contains......
At my attempt thus far I have:
ALTER TABLE [table_name]
ADD [new_element] varchar(5)
IF
CONTAINS([column_name], "HLTH")
I probably am horrible off, and could use some help. Thanks!