How To Generate XML File…From the Table…

bghafhsnhkk

New Member
I have successfully imported the following XML file ...\[code\]DECLARE @idoc intDECLARE @doc xmlDECLARE @xmldata Table (FirstName varchar(110), LastName varchar(210), Email varchar(110), Phone varchar(110), Position varchar(110), Branch varchar(110), Address varchar(110))SET @doc ='<Root> <Node FirstName="Andrew" LastName="Fuller" Email="[email protected]" Phone="(205) 555 - 9898" Position="CEO" Branch="TopManagement" Address="London, 120 Hanover Sq."> <Node FirstName="Jeremy" LastName="Boather" Email="[email protected]" Phone="(205) 555 - 9888" Position="President QA" Branch="QA" Address="London, 120 Hanover Sq."> <Node FirstName="Anne" LastName="Dodsworth" Email="[email protected]" Phone="(205) 555 - 9887" Position="VP QA" Branch="QA" Address="London, 120 Hanover Sq."> <Node FirstName="Alexander" LastName="Tuckings" Email="[email protected]" Phone="(205) 555 - 9886" Position="Team Lead Team1" Branch="QA" Address="London, 120 Hanover Sq."> <Node FirstName="Brenda" LastName="Smith" Email="[email protected]" Phone="(205) 555 - 9885" Position="Senior QA" Branch="QA" Address="London, 120 Hanover Sq."/> </Node> <Node FirstName="Mary" LastName="Bird" Email="[email protected]" Phone="(205) 555 - 9885" Position="Team Lead Team2" Branch="QA" Address="London, 120 Hanover Sq."/> </Node> </Node> <Node FirstName="Steven" LastName="Buchanan" Email="[email protected]" Phone="(205) 555 - 9897" Position="President Dev Dept." Branch="Development" Address="London, 120 Hanover Sq."> <Node FirstName="Robert" LastName="King" Email="[email protected]" Phone="(205) 555 - 9896" Position="VP Dev Dept." Branch="Development" Address="London, 120 Hanover Sq."> <Node FirstName="Laura" LastName="Callahan" Email="[email protected]" Phone="(205) 555 - 9892" Position="Team Lead Team1" Branch="Development" Address="London, 120 Hanover Sq."> <Node FirstName="Jason" LastName="Roland" Email="[email protected]" Phone="(205) 555 - 9872" Position="Senior Dev" Branch="Development" Address="London, 120 Hanover Sq."> </Node> </Node> <Node FirstName="Eric" LastName="Danstin" Email="[email protected]" Phone="(205) 555 - 9882" Position="Team Lead Team2" Branch="Development" Address="London, 120 Hanover Sq."> <Node FirstName="Elizabeth" LastName="Lincoln" Email="[email protected]" Phone="(205) 555 - 9862" Position="Senior Dev" Branch="Development" Address="London, 120 Hanover Sq."> </Node> <Node FirstName="Margaret" LastName="Peacock" Email="[email protected]" Phone="(205) 555 - 9852" Position="Senior Dev" Branch="Development" Address="London, 120 Hanover Sq."> </Node> </Node> </Node> </Node> </Node></Root>'EXEC sp_xml_preparedocument @idoc OUTPUT, @docInsert @xmldataSELECT *FROM OPENXML (@idoc,'//Node',1) WITH (FirstName varchar(110), LastName varchar(210), Email varchar(110), Phone varchar(110), Position varchar(110), Branch varchar(110), Address varchar(110))select * from @xmldata \[/code\]I want to export the same XML file using the output daata (Table Value ). How to export XML file?
 
Back
Top