can some one please explain how would I add a prefix to column “Name” in my scenario.
I would like to create UNION between two identical tables.
Both contain a field “Name”. In the column name I want to add a prefix “TABLE-A-” or “TABLE-B-“.
I know i can do this by N'PREFIX' + Name in the select, but the problem is that some records already have the prefix and some dont. So by using this would create a double prefix for those records…
Any idea?
You can use a
CASEexpression to conditionally add the prefix: