Click here to Skip to main content
15,917,321 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have an XML file which I need to import into SQL. I have found info on how to do this if it all eneres into one table but nothing in the format I need.

My XML is as follows:

HTML
-<Booking> <BookingRef>HAY-03627</BookingRef> <BookingDate>11-04-11</BookingDate> <DepartureDate>09-14-12</DepartureDate> <ReturnDate>09-28-12</ReturnDate> <DebtorID>0001DIR</DebtorID> <DebtorName>Direct Sales</DebtorName> <BranchID>020</BranchID> <GrossPrice>3651.00</GrossPrice> <NettPrice>3651.00</NettPrice> <Commission>0.00</Commission> <CommissionVAT>0.00</CommissionVAT> <Deposit>0.00</Deposit> <CardPayment>0.00</CardPayment> <CashPayment>1270.00</CashPayment> <ChequePayment>0.00</ChequePayment> <TotalPayment>1270.00</TotalPayment> <Outstanding>2381.00</Outstanding> <BalanceDue>06-22-12</BalanceDue> <LastModified>02-15-12</LastModified> <SourceCode/> <ProductType>PKG</ProductType> <ABTA>E9022</ABTA> <ATOL/> <LeadPassenger>Hall</LeadPassenger> <Duration>14</Duration> <Adults>2</Adults> <Children>1</Children> <Infants>0</Infants> <Seniors>0</Seniors> -<BookingElements> -<BookingElement> <BookingItem>1</BookingItem> <ElementRef>HAY-03627/1</ElementRef> <ElementType>Miscellaneous</ElementType> <GrossSale>777.00</GrossSale> <Commission>0.00</Commission> <CommissionVAT>0.00</CommissionVAT> <CreditorID/> <CreditorName/> <CreditorCurrency>GBP</CreditorCurrency> <NettOriginatingCurrency>777.00</NettOriginatingCurrency> <BookingExchangeRate>1</BookingExchangeRate> <NettSterling>777.00</NettSterling> <Deposit>0.00</Deposit> <LastModified>11-04-11</LastModified> <SupplyInEC/> <SupplierReference>986604</SupplierReference> <Adults>2</Adults> <Children>1</Children> <Infants>0</Infants> <Seniors>0</Seniors> <Type>Miscellaneous</Type> <Description>14days Ulitmate Disney ticket</Description> <Duration>14</Duration> </BookingElement>-<BookingElement> <BookingItem>2</BookingItem> <ElementRef>HAY-03627/2</ElementRef> <ElementType>Miscellaneous</ElementType> <GrossSale>53.85</GrossSale> <Commission>0.00</Commission> <CommissionVAT>0.00</CommissionVAT> <CreditorID/> <CreditorName/> <CreditorCurrency>GBP</CreditorCurrency> <NettOriginatingCurrency>53.85</NettOriginatingCurrency> <BookingExchangeRate>1</BookingExchangeRate> <NettSterling>53.85</NettSterling> <Deposit>0.00</Deposit> <LastModified>11-04-11</LastModified> <SupplyInEC/> <SupplierReference>LVUVQ</SupplierReference> <Adults>2</Adults> <Children>1</Children> <Infants>0</Infants> <Seniors>0</Seniors> <Type>Miscellaneous</Type> <Description>Man Airport Lounge</Description> <Duration>0</Duration> </BookingElement>-<BookingElement> <BookingItem>3</BookingItem> <ElementRef>HAY-03627/3</ElementRef> <ElementType>Package</ElementType> <GrossSale>2736.80</GrossSale> <Commission>0.00</Commission> <CommissionVAT>0.00</CommissionVAT> <CreditorID/> <CreditorName/> <CreditorCurrency>GBP</CreditorCurrency> <NettOriginatingCurrency>2736.80</NettOriginatingCurrency> <BookingExchangeRate>1</BookingExchangeRate> <NettSterling>2736.80</NettSterling> <Deposit>450.00</Deposit> <LastModified>11-04-11</LastModified> <SupplyInEC>N</SupplyInEC> <SupplierReference>2969663</SupplierReference> </BookingElement>-<BookingElement> <BookingItem>4</BookingItem> <ElementRef>HAY-03627/4</ElementRef> <ElementType>Hotel</ElementType> <GrossSale>93.00</GrossSale> <Commission>0.00</Commission> <CommissionVAT>0.00</CommissionVAT> <CreditorID/> <CreditorName/> <CreditorCurrency>GBP</CreditorCurrency> <NettOriginatingCurrency>93.00</NettOriginatingCurrency> <BookingExchangeRate>1</BookingExchangeRate> <NettSterling>93.00</NettSterling> <Deposit>0.00</Deposit> <LastModified>01-27-12</LastModified> <SupplyInEC>Y</SupplyInEC> <SupplierReference>lvsax</SupplierReference> <Adults>2</Adults> <Children>1</Children> <Infants>0</Infants> <Seniors>0</Seniors> <Duration>1</Duration> <HotelName>Brittiania Country House</HotelName> <Resort>Manchester Airport</Resort> <Country>GB</Country> <BoardBasis>Room Only</BoardBasis> <StarRating>3</StarRating> </BookingElement>-<BookingElement> <BookingItem>5</BookingItem> <ElementRef>HAY-03627/5</ElementRef> <ElementType>Car Hire</ElementType> <GrossSale>0.00</GrossSale> <Commission>0.00</Commission> <CommissionVAT>0.00</CommissionVAT> <CreditorID/> <CreditorName/> <CreditorCurrency>GBP</CreditorCurrency> <NettOriginatingCurrency>0.00</NettOriginatingCurrency> <BookingExchangeRate>1</BookingExchangeRate> <NettSterling>0.00</NettSterling> <Deposit>0.00</Deposit> <LastModified>11-04-11</LastModified> <SupplyInEC/> <SupplierReference>11436775</SupplierReference> <PickupAirport>Orlando International</PickupAirport> <PickupDate>2012-09-14 15:00:00</PickupDate> <DropoffDate>2012-09-28 17:00:00</DropoffDate> <Duration>14</Duration> <Vehicle/> </BookingElement> </BookingElements> -<BookingReceipts> -<Receipt> <Description>Cash</Description> <Amount>450.00</Amount> <HandlingFee>0.00</HandlingFee> <MerchantFee>0.00</MerchantFee> </Receipt>-<Receipt> <Description>Cash</Description> <Amount>300.00</Amount> <HandlingFee>0.00</HandlingFee> <MerchantFee>0.00</MerchantFee> </Receipt>-<Receipt> <Description>Cash</Description> <Amount>460.00</Amount> <HandlingFee>0.00</HandlingFee> <MerchantFee>0.00</MerchantFee> </Receipt>-<Receipt> <Description>Cash</Description> <Amount>60.00</Amount> <HandlingFee>0.00</HandlingFee> <MerchantFee>0.00</MerchantFee> </Receipt> </BookingReceipts> -<BookingSupplements> -<Supplement> <Description>Discount</Description> <Amount>-9.65</Amount> <vat>0.00</vat> </Supplement> </BookingSupplements> </Booking></BookingList>



How do I go about this import please?
Posted
Comments
Herman<T>.Instance 29-Mar-12 10:53am    
which SQL server?

1 solution

 
Share this answer
 
Comments
Sandeep Mewara 30-Apr-12 1:25am    
Good MSDN link! 5ed.
Maciej Los 30-Apr-12 8:07am    
Thank you ;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900