Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
BravehearT1326
Starting Member
24 Posts |
Posted - 2010-08-11 : 04:25:10
|
Hi there - looking for guidance on generating output in XML format. I have a new application that we need to drip feed info into and it needs to be in a specific XML format. Having not done any of this in the past and my TSQL being not as good as it should I'm looking for guidance on how best to do this.I have managed to generate part of the XML file structure successfully however there appears to be around 3-4 different sections in it and looking to see what is the best way for this structure to be generated. I dont know how to join all the sections togetherThe XML file needs to be in the structure below. The section in BOLD is what I have managed to generate so far using the FOR XML PATH , ROOT options but I need to be able to generate the totals section details at the top. Whats the best way to do this and produce 1 large XML structured file? Do i need to build temp tables - insert the data into them then extract.....if so how would I build the different sections?Any help appreciated.--<counters><CurrencyTotalCount>13</CurrencyTotalCount><CurrencyRateInsertCount>1</CurrencyRateInsertCount><CurrencyRateHistoricInsertCount>12</CurrencyRateHistoricInsertCount><PersonTotalCount>0</PersonTotalCount><PersonInsertCount>0</PersonInsertCount><PersonUpdateCount>0</PersonUpdateCount><PolicyTotalCount>0</PolicyTotalCount><PolicyInsertCount>0</PolicyInsertCount><PolicyRefreshCount>0</PolicyRefreshCount><PolicyRenewalCount>0</PolicyRenewalCount><PolicyDeleteCount>0</PolicyDeleteCount><PolicyUpdateCount>0</PolicyUpdateCount><PolicyCancelCount>0</PolicyCancelCount><PolicyReinstateCount>0</PolicyReinstateCount></counters>- <CurrencyRateInsert><BaseCurrency>GBP</BaseCurrency>- <CurrencyRatesInstance><Date>2008-07-02T00:00:00</Date>- <CurrencyList>- <CurrencyRate><Name>ZZB</Name><Rate>1</Rate></CurrencyRate></CurrencyList></CurrencyRatesInstance></CurrencyRateInsert>- <CurrencyRateHistoricInsert><BaseCurrency>GBP</BaseCurrency>- <CurrencyRatesInstanceList>- <CurrencyRatesInstance><Date>2005-01-01T00:00:00</Date>- <CurrencyList>- <CurrencyRate><Name>ZZA</Name><Rate>1.2661292721</Rate></CurrencyRate>- <CurrencyRate><Name>ZZB</Name><Rate>1</Rate></CurrencyRate></CurrencyList></CurrencyRatesInstance>- <CurrencyRatesInstance><Date>2005-04-01T00:00:00</Date>- <CurrencyList>- <CurrencyRate><Name>ZZA</Name><Rate>1.2661292721</Rate></CurrencyRate>- <CurrencyRate><Name>ZZB</Name><Rate>1</Rate></CurrencyRate></CurrencyList></CurrencyRatesInstance> |
|
|
|
|