Given few strings as
SET @Codes1 = 3,4
SET @Codes2 = 1
SET @Codes3 = --empty
Table -- TblCode
Id Code
1 A
2 B
3 C
4 D
How to convert the @Codes1, @Codes2, @Codes3
with join to the table TblCode
so it returns the following output :
1. @Codes1 = CD
2. @Codes2 = A
3. @Codes3 = --empty
Note that the concatenation for the output is without the comma.
PS - This is a small example to a much larger and complex data set. Kindly ignore any wrongful design pattern here.