All i need is to remove last character which is comma (,) in this case.
I tried Substring, Left, and Right functions but they need length of the string.
Here is the scenario:-
select
(Case col1 & 1 When 1 Then 'Case 1,' Else '' End) +
(Case Col2 & 2 When 2 Then 'Case 2,' Else '' End) +
(Case Col3 & 4 When 4 Then 'Case 4,' Else '' End)
as Case
from table_01
Well, just don’t remove the last comma. Remove the first one instead:
using
STUFF():using
SUBSTRING():