EDN Admin
Well-known member
Hi,
Im using OpenXML in Stored procedure to read the input XML and populate SQL tables. I have a pretty large XML which has data to be inserted into 15 tables. I want create 15 stored procedures so that each of them handles inserts into one table.
I have one main Stored procedure that gets the complete XML and from there I want to split this xml into smaller trees and pass them to the corresponding stored procedures.
In the below example, Im looking at a way to extract the XML "
<table2>
<data col1=val1 col2=val2 />
<data col1=val1 col2=val2 />
<data col1=val1 col2=val2 />
</table1>" to pass it to another stored proc.
Example:
<Data>
<col1>val1</col1>
<col2>val2</col2>
<table2>
<data col1=val1 col2=val2 />
<data col1=val1 col2=val2 />
<data col1=val1 col2=val2 />
</table1>
<table2>
<data col1=val1 col2=val2 col3=val3 col4=val4/>
<data col1=val1 col2=val2 col3=val3 col4=val4/>
<data col1=val1 col2=val2 col3=val3 col4=val4/>
<data col1=val1 col2=val2 col3=val3 col4=val4/>
</table2>
</data>
Please note that I have just made up a XML, please ignore the syntax errors in the xml.
I would greatly appreciate any inputs!
Thank You!
View the full article
Im using OpenXML in Stored procedure to read the input XML and populate SQL tables. I have a pretty large XML which has data to be inserted into 15 tables. I want create 15 stored procedures so that each of them handles inserts into one table.
I have one main Stored procedure that gets the complete XML and from there I want to split this xml into smaller trees and pass them to the corresponding stored procedures.
In the below example, Im looking at a way to extract the XML "
<table2>
<data col1=val1 col2=val2 />
<data col1=val1 col2=val2 />
<data col1=val1 col2=val2 />
</table1>" to pass it to another stored proc.
Example:
<Data>
<col1>val1</col1>
<col2>val2</col2>
<table2>
<data col1=val1 col2=val2 />
<data col1=val1 col2=val2 />
<data col1=val1 col2=val2 />
</table1>
<table2>
<data col1=val1 col2=val2 col3=val3 col4=val4/>
<data col1=val1 col2=val2 col3=val3 col4=val4/>
<data col1=val1 col2=val2 col3=val3 col4=val4/>
<data col1=val1 col2=val2 col3=val3 col4=val4/>
</table2>
</data>
Please note that I have just made up a XML, please ignore the syntax errors in the xml.
I would greatly appreciate any inputs!
Thank You!
View the full article