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)
 Setting a variable while using xmlnamespace

Author  Topic 

Revision17
Starting Member

1 Post

Posted - 2008-02-04 : 03:33:28
So, I'm trying to set a variable to an xml path query.
This works:

declare @foo xml;
set @foo = (select 'boo' "Test" for xml path('Testing'));

This does not:

declare @foo xml;
set @foo = (with XMLNAMESPACES (
DEFAULT 'http://example.com'
) select 'boo' "Test" for xml path('Testing'));


Any ideas on how to fix this, or do it differently so that it does work?
   

- Advertisement -