Question

When trying to export a data tier application or dacpac from a database that contains functions that use "for xml" every single function and every single object that depends upon that function fails and I am not able to create the dacpac. The wizard reports those objects as not supported.

Database : SQL Server 2008 R2

The error that the functions fail with:

[dbo].[fn_FunctionName] () Failed Depends on object '[XmlData].[value] (UnresolvedEntity)', which does not exist in this database.

Example query:

declare @XMLColumn xml = '<Example><Node>Test</Node></Example>'

select XmlData.value('.', 'varchar(50)') + ';' 
from @XMLColumn.nodes('/Example/Node') T2(XmlData)
for xml path('')
Était-ce utile?

La solution

I know it has been a long time but changing your query to the following

declare @XMLColumn xml = '<Example><Node>Test</Node></Example>'

select T2.XmlData.value('.', 'varchar(50)') + ';' 
from @XMLColumn.nodes('/Example/Node') T2(XmlData)
for xml path('')
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top