traversing the XML structure to create OPENXML structure
Posted on 2005-04-07
I have the following code. What I want to do is to pass in the XML structure to some user defined function and returns a string back. I want to make a generic user defined function but it appears that there exists no such thing that will traverse the XML dom and and returns child node and parents. Just like we can traverse the DOM thru System.XML namespace.
so the following input to a user defined function should return me the following string avoiding the necessary HARCODING inside select * from OPENXML. Still we can have one user defined function per XML but that is not desirable - more code to maintain
group_id='100' AND order_number='1025'
set @doc = '<Criteria>
exec sp_xml_preparedocument @idoc OUTPUT, @doc
select * from
openxml (@idoc , '/Criteria' , 2)
With (Group_ID int 'Group_id' ,
Order_Number int 'Order_Number' )
where Group_id = 100 and Order_Number = 1025