declare @xml xml;
DECLARE @idoc int;
select @xml=(select * from [HumanResources].[Employee]
for xml auto,root('Employeedetails'))
select @xml
EXEC sp_xml_preparedocument @idoc OUTPUT, @xml
-- SELECT
statement that uses the OPENXML rowset provider.
SELECT *
FROM OPENXML (@idoc, '/Employeedetails/HumanResources.Employee')
with (BusinessEntityID int ,
NationalIDNumber varchar(10) ,
OrganizationNode varchar(100) ,
OrganizationLevel int ,
JobTitle varchar(100) )
EXEC sp_xml_removedocument @idoc
No comments:
Post a Comment