Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

OPENXML

declare @result int


declare @input char(300)
set @input='<root><employee>
<id>1001</id>
<name>Janet</name>
<dept>IT</dept>
</employee>
<employee>
<id>1002</id>
<name>Vijaya</name>
<dept>SQL</dept>
</employee>

</root>'
exec sp_xml_preparedocument @result output,@input
select * from openxml(@result,'/root/employee',2)with (id int,
name char(20), dept char(20))

exec sp_xml_removedocument @result

You might also like