Say I have a table as shown below
Product_Id Description
BX01 Desc 1
BxX1 Desc 2
Dss3 Desc 3
HHXY Desc 4
I want the result exactly like: 1 - BX01, 2 - BxX1, 3 - Dss3, 4 - HHXY
I have this query:
DECLARE @ProID VARCHAR(8000)
SELECT @ProID = COALESCE(@ProID + ' - ', '') + Product_Id FROM TABLE
SELECT @ProID
but the return values is only :
BX01,- BxX1,- Dss3,- HHXY
.
The counting is lacking.
How to do that?
thanks