How can I query xml data in column type xml using an xml schema from the same table row in the xmlschema column and return values(not xml) to insert into a seperate table
XML Data Table
C1 =RecordID (int)
C2 =XMLData (xml)
C3 = XMLSchema(xml)
How can I query the XML data using the xmlshema column
and return values(not xml) to insert into table 2
Table 2
C1 = RecordID
C2 = User
C3 = date
thanks
I think you are looking for the XQuery "nodes()" function if I understand you correctly. It sounds like you want to reach into the column that is storing the schema, extract scalar values from that schema and store it in a relational table. If this is what you are trying to do, then the nodes() function should work for you.
Here is an example using the nodes() function on the xml data type.
http://msdn2.microsoft.com/en-us/ms188282.aspx
Once you get the data into relational form, you can CURSOR over it and call your INSERT statement with parameters, use INSERT INTO ... SELECT, or generate dynamic SQL.
No comments:
Post a Comment