I'm trying to update the following a column where if part number has an option to put a '#' between the middle and concatenate the two columns together, else if the part number hasn't a option to show the part number only i.e
part_number option Merged
45556 GHJ 45556#GHJ
45666 UOY 45666
I've tried the follow but no luck:
set MERGED = '[PartNumber] & IIf(IsNull(Option),"","#" & PartNumber)'
Disallowed implicit conversion from data type varchar to data type varbinary, table 'TableA', column 'MERGED'. Use the CONVERT function to run this query.