I have many columns in a table which needs to be checked against some value and values needs to be replaced if match found..
So basically I am looking for a query which takes column name as sort of variable and loops through the table and updates the column value if matched..
I could do that with php, having as many queries as columns.. but that’s what I don’t want..
p.s. I know its a bad design, and in normal case such requirements never occur, but sadly it is what it is..
In many statements:
In one statement
You can write the statements by hand or with dynamic SQL (if the columns and tables to work are too many).