jeck猫
20-- 数据库用户名 UAGReport 表名student 已创建use UAGReportgoDECLARE @doc varchar(1000)DECLARE @idoc intSET @doc='<ROOT><student><id>6</id><name>sun</name><sex>male</sex><age>24</age></student></ROOT>'exec sp_xml_preparedocument @idoc output,@docselect * from openxml(@idoc,'/ROOT/student',2)with(id int,name varchar(40),sex varchar(20), age int)insert studentselect * from openxml(@idoc,'/ROOT/student',2)with studentexec sp_xml_removedocument @idoc