In projects, data submission from the master and slave tables is often encountered. It is much easier to use sp_xml_preparedocument to input XML competing SQL statements.
Declare @ XML varchar (1024)
Set @ xml = '<root> <code id = "030001"> <point id = "01"/> <point id = "02"/> </code> </ root>'
Declare @ hdoc int
Exec sp_xml_preparedocument @ hdoc out, @ XML
Select * from
Openxml (@ hdoc, '/root/code/point', 2)
With
(
Itemcode varchar (36) '../@ id ',
Point varchar (36) '@ id'
) As
-- The result set a contains information about the master and slave tables.
-- Insert into tablea select * from
Exec sp_xml_removedocument @ hdoc
For a detailed introduction to this stored procedure, see here http://www.yesky.com/imagesnew/software/tsql/ts_sp_xml_267o.htm
For more information about openxml, click here http://www.itcankao.cn/ShowTopic/Topic_21_Art_677.html
On the official msdn website, I cannot open it here. If you prefer to visit the official website, Google it.