I am trying to concatenate BLOCK_ID1, BLOCK_ID2 and BLOCK_ID3 into one string in BLOCK_ID. I want to remove the last comma in the string.
MyDE
UNIQUE_ID | BLOCK_ID1 | BLOCK_ID2 | BLOCK_ID3 |
---|---|---|---|
A | 1 | 2 | 3 |
B | 1 | 2 | |
C | 1 |
When i do:
SELECT UNIQUE_ID,
CONCAT(BLOCK_ID1,', ', BLOCK_ID2, ', ', BLOCK_ID3) as BLOCK_ID
From MyDE
OUTPUT DE:
UNIQUE_ID | BLOCK_ID |
---|---|
A | 1, 2, 3 |
B | 1, 2, |
C | 1, |
I want to remove the last comma from B and C
t-sql remove last character comma
and the solution here helped me: social.msdn.microsoft.com/Forums/sqlserver/en-US/…