sql - Derived Column FindString Error -
i have dataset below
s.no column_a column_b 1 san diego sewage department hello 2 california sewage plant hi 3 paulo alto sewage yolo
now need find , replace sewage department, sewage plant, sewage sd
so final result should like
s.no column_a column_b 1 san diego sd hello 2 california sd hi 3 paulo alto sd yolo
i have tried writing in derived column not of them getting converted
findstring(column_a,"sewage%",1)>0 ? replace(column_a,"sewage%","") + "sd" : column_a
i think issue using sql wild card in functions, , far know don't accept wild cards.
i think following equivalent:
findstring(column_a,"sewage",1) > 0 ? substring(column_a, 1, findstring(column_a,"sewage",1) - 1) + "sd" : column_a
Comments
Post a Comment