> ; WITH CTE (list) AS (
> SELECT ltrim(str(id)) + ','
> FROM tblusers
> WHERE name = 'smith'
> FOR XML PATH('')
> )
> SELECT substring(list, 1, len(list) - 1)
> FROM CTE
Thanks Erland. I was thinking along the lines of a CTE... Very powerful, if you know how to do it! Thanks.