Click here to Skip to main content
14,973,970 members

Comments by Anton Burtsev (Top 3 by date)

Anton Burtsev 9-Mar-11 2:29am View
   
Deleted
We need to get one singe string value from multiple rows. Since MS SQL have no aggregation function for string concatenation we have a number of options for that task. One of them is FOR XML.
Anton Burtsev 8-Mar-11 13:40pm View
   
Deleted
1. Actually I didn't understand what you mean by

select ProductName+','
from Northwind..Products

Where is concatenation??? My tip is about concatenation.

2. I use SQL Server 2008. I believe that in previous versions you can change
@var += value
to
@var = @var + value
However, I'm not sure about recurrent expressions in previous SQL Server versions too :-)
Anton Burtsev 8-Mar-11 10:43am View
   
Deleted
Do you mean

select @ProductName += ProductName + ','
from Northwind..Products

"+=" operator is very slow in case of large strings. switching to XML is something like using StringBuilder in C# instead of concatenating strings.