Home Forums SQL Server 2005 Development I need to create an XML file populated by fields data(eg: SQL Server DB table) RE: I need to create an XML file populated by fields data(eg: SQL Server DB table)

  • well, the xml you posted is malformed; it is either missing two tags in the middle, or these two tags below need to be removed from the middle:

    </DataMarketsFeedMsg>

    </DataMarketsFeed>

    the real question is, do you already have a suite of tables in SQL already in place that support the fields that are required in this xml?

    without that, you are stuck; it's too much guesswork for us to create the DDL to support it.

    What code do you have so far?

    what have you tried so far?

    can you post the DDL of the tables, and a sample query that pulls the fields out (which we could help convert to xml)

    FYI this is valid xml, where i removed the extra tags from the middle; is htis right?

    <?xml version="1.0" encoding="UTF-8"?>

    <DataMarketsFeed xmlns="http://www.test.co.uk/XMLSchema/DataMarketsFeed-v1-2" xmlns:cmn="http://www.test.co.uk/XMLSchema/DataFeedCommon-v1-2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <DataFeedHeader xmlns="http://www.test.co.uk/XMLSchema/DataFeedCommon-v1-2">

    <FeedTargetSchemaVersion>1.2</FeedTargetSchemaVersion>

    <Submitter>

    <SubmittingFirm>123456</SubmittingFirm>

    </Submitter>

    <ReportDetails>

    <ReportCreationDate>2009-03-12</ReportCreationDate>

    <ReportIdentifier>March09</ReportIdentifier>

    </ReportDetails>

    </DataFeedHeader>

    <DataMarketsFeedMsg>

    <CoreItemsMkt xmlns="http://www.Test.co.uk/XMLSchema/DataMarketsFeed-v1-2">

    <FirmDataRef>123789</FirmDataRef>

    <TransRef>123789</TransRef>

    <Cancellation>false</Cancellation>

    <Status>N</Status>

    </CoreItemsMkt>

    <Transaction>

    <ReportingFirmId>

    <ReportingFirmCode type="R">123456</ReportingFirmCode>

    </ReportingFirmId>

    <TradingDate>2009-02-27</TradingDate>

    <TradingTime>08:02:00</TradingTime>

    <BuySell>B</BuySell>

    <TradingCapacity>P</TradingCapacity>

    <InstrumentIdentification>

    <InstrumentIdentificationCode type="A">R</InstrumentIdentificationCode>

    </InstrumentIdentification>

    <MaturityExerciseDeliveryDate>2009-03-31</MaturityExerciseDeliveryDate>

    <TypeOfDerivative>F</TypeOfDerivative>

    <PriceMultiplier>10</PriceMultiplier>

    <UnitPrice>3836</UnitPrice>

    <PriceNotation>GBP</PriceNotation>

    <Quantity>3.00</Quantity>

    <CounterpartyOne>

    <CounterpartyCode type="I">QWERTYU</CounterpartyCode>

    </CounterpartyOne>

    <CounterpartyTwo>

    <CounterpartyCode type="I">ASB00037</CounterpartyCode>

    </CounterpartyTwo>

    <VenueIdentificationTypeCode>M</VenueIdentificationTypeCode>

    <UnitPriceTypeCode>C</UnitPriceTypeCode>

    </Transaction>

    <CoreItemsMkt xmlns="http://www.Test.co.uk/XMLSchema/DataMarketsFeed-v1-2">

    <FirmDataRef>123789</FirmDataRef>

    <TransRef>123789</TransRef>

    <Cancellation>false</Cancellation>

    <Status>N</Status>

    </CoreItemsMkt>

    <Transaction>

    <ReportingFirmId>

    <ReportingFirmCode type="R">123456</ReportingFirmCode>

    </ReportingFirmId>

    <TradingDate>2009-02-27</TradingDate>

    <TradingTime>08:02:00</TradingTime>

    <BuySell>B</BuySell>

    <TradingCapacity>P</TradingCapacity>

    <InstrumentIdentification>

    <InstrumentIdentificationCode type="A">R</InstrumentIdentificationCode>

    </InstrumentIdentification>

    <MaturityExerciseDeliveryDate>2009-03-31</MaturityExerciseDeliveryDate>

    <TypeOfDerivative>F</TypeOfDerivative>

    <PriceMultiplier>10</PriceMultiplier>

    <UnitPrice>3836</UnitPrice>

    <PriceNotation>GBP</PriceNotation>

    <Quantity>3.00</Quantity>

    <CounterpartyOne>

    <CounterpartyCode type="I">QWERTYU</CounterpartyCode>

    </CounterpartyOne>

    <CounterpartyTwo>

    <CounterpartyCode type="I">ASB00037</CounterpartyCode>

    </CounterpartyTwo>

    <VenueIdentificationTypeCode>M</VenueIdentificationTypeCode>

    <UnitPriceTypeCode>C</UnitPriceTypeCode>

    </Transaction>

    </DataMarketsFeedMsg>

    </DataMarketsFeed>

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!