sql server 2008 - How can I nest stored procedures that return XML using FOR XML PATH? -



sql server 2008 - How can I nest stored procedures that return XML using FOR XML PATH? -

i have xml path stored procedure returns xml in usual manner (shortened clarity):

create procedure sp_returnsubnode begin select subnode.subnodeid "@subnodeid" ,subnode.somedata "somedata" subnode xml path('subnode') end

i have stored procedure include results of above query within e.g.

create procedure sp_returnmainxml begin select node.nodeid "@nodeid" ,node.nodedata "data" ,[at point phone call sp_returnsubnode , nest it] ,node.moredata "moredata" node xml path ('node') end

but methods have tried assigning results of executing sp_subnode xml datatype , attempting nest have failed.

this seems people want haven't found reference on how it. possible?

you can user defined functions returns xml.

a function returning xml:

create function getsubnode(@p int) returns xml begin homecoming ( select @p '@subnodeid', 'subnoddata' somedata xml path('subnode'), type ) end

use this:

select nodeid '@nodeid', nodedata data, dbo.getsubnode(nodeid), moredata node xml path('node')

xml sql-server-2008 for-xml-path

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -