将XML数据导入一组SQL表 [英] Import XML data into a set of SQL tables

查看:74
本文介绍了将XML数据导入一组SQL表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个XML文件,需要将其导入SQL.我已经找到了有关如何将所有信息整合到一张表中但没有我需要的格式的信息.

我的XML如下:

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:

-<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?




How do I go about this import please?

推荐答案

http://msdn.microsoft.com/en-us/library/ms191184.aspx[^]
http://stackoverflow.com/questions/958197/importing-xml-data-into-ms-sql-server-programmatically[^]


这篇关于将XML数据导入一组SQL表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆