I am trying to build a select statement that I will pass to a tored proc as xml. basically, I want to wrap the ids that are returned in xml tags, like this:
...the query statement I am trying to run looks like:
select distinct @myxml = '<id>' + convert(varchar(25), id) + '</id>'
where coalesce(IsCompleted, 0) = 0
This only returns the first value it hits (i.e. - <id>123</id>). I also tried inserting the results into a table variable and building the string by selecting one row at a time, that didnt work either, it returns a null.