I have a MS SQL query like this (please apologize for german field names):
SUBSTRING((SELECT ',' + dw2.barcode2 FROM [dbo].[dtable] dw2
WHERE dw2.belegnummer = dw1.belegnummer AND barcode2 LIKE 'A%' FOR XML PATH('')),2,8000))
FROM (SELECT DISTINCT belegnummer FROM [dbo].[dtable] WHERE barcode2 LIKE 'A%' AND belegnummer IS NOT NULL) dw1
This is used to concatenate field values of barcode2 field in the case that more than one unique belegnummer record exists (in fact it does it also if only one exists, but that's no problem). The query works fine, but I need to write the result (the second 'field' from the above SELECT) into a field (additionalBC) of that record.
I can't get it working. Every time I try to use UPDATE, MS SQL tells me that the update field additionalBC is unknown. As I didn't do much UPDATE stuff in the past, I think it's just a little thing missing, but I'm not an expert...