CREATE TABLE #Temp([Numbers] varchar(20))
INSERT INTO #Temp VALUES('asp');
INSERT INTO #Temp VALUES('.net');
INSERT INTO #Temp VALUES('database');
INSERT INTO #Temp VALUES('views');
INSERT INTO #Temp VALUES('temp');
DECLARE @str VARCHAR(200)
SELECT @str = COALESCE(@str + '-', '') + [Numbers]
FROM #Temp
Print @str
Here is the output: asp-.net-database-views-temp
Orijinal article for combine rows in one table in mssql
No comments:
Post a Comment