[thelist] SQL: How Do I Combine Multiple Rows into One?

rudy r937 at interlog.com
Mon Mar 3 18:15:00 CST 2003

> This would seem to require some sort of looping,
> which isn't a particularly robust feature in Transact-SQL

i guess that depends on what your definition of "robust" is

> Can anyone suggest a reasonably straightforward approach?

yeah, a stored proc

there are several techniques discussed in various tutorials
at http://sqlteam.com

one of them turns multiple rows into a comma-separated list


the technique is remarkable because it *doesn't* use looping

another method uses a temp table, i think

have a look around, if you don't find something that you can adapt,
give another holler

it's been a long time since i wrote a stored proc

but i don't recall thinking the looping wasn't robust



More information about the thelist mailing list