i have xml source. xml source having lacks of records. i
want extract/retrive xml source data using sql query.
please tell me how to write query.

Answer Posted / jagadeesh

create procedure proc_es
as
begin
declare @hdoc int
DECLARE @xml xml
set @xml=(select *
From openrowset(Bulk'C:\emp18.xml', single_blob) as xmldata)
exec sp_xml_preparedocument @hdoc output,@xml
insert into emp19(emp_id,emp_fname,emp_lname,emp_mail)
select *
from openxml(@hdoc,'/employee/details',3)
with(emp_id int,emp_firstname varchar(50),emp_lastname varchar(50),emp_mailid varchar(50))
exec sp_xml_removedocument @hdoc
end

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When is the update_statistics command used?

765


What is oracle sql developer?

786


What is sqlcommand?

747


What are the uses of merge?

890


What are different types of keys?

732






how to use 'mysql' to run sql statements? : Sql dba

733


What is pl/sql table? Why is it used?

730


What will you get by the cursor attribute sql%notfound?

777


What is the use of pl/sql table?

751


What are keys in sql?

721


What is record in pl sql?

764


How to make a copy values from one column to another in sql?

764


What happens when a trigger is associated to a view?

672


What are all the different types of indexes?

800


What is pl/sql table? Why it is used?

730