A while ago I wrote an article about various ways to concatenate all the values in a set of rows into a single string value. Most solutions to this problem use some sort of looping or recursive method, but a recent forum posting alerted me to a relatively easy way to achieve this using a select statement.
To demonstrate this I’ll create a table and populate it :
Then run the following code :
You can see that the @ColourList variable contains the desired concatenated value :
No comments:
Post a Comment