Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Store the output of the Select Query with XML

Author  Topic 

sqlilliterate
Starting Member

40 Posts

Posted - 2008-02-20 : 01:51:54
How do i store the result of a select query with XML in a single variable ?

for e.g.

I want to store the result of the following query in a variable(@text), where the output of the query is a single column

Select * from <Table1> for XML auto

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-02-20 : 01:56:22
DECLARE @var varchar(max)
select @var=t1.list
from
(
select * from @table for xml auto)t1(list)

select @var as 'returnvalue'
Go to Top of Page
   

- Advertisement -