Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2011
    Posts
    2

    Unanswered: Urgent Help Needed

    Need Help , I need get the xml in this format

    <Result>
    <Project ProjectID=755 AgentID= 1 >
    <Lang_SRC>
    <ProjectID>755</ProjectID>
    <agentID>1</agentID>
    <ProjectLang>ENG</ProjectLang>
    <ImplID>1</ImplID>
    <Name>Impl 1</Name>
    <Address><![CDATA[2]]></Address>
    <City>3</City>
    <Country>4</Country>
    <Phone>5</Phone>
    <Fax>6</Fax>
    <Email>7</Email>
    <Website><![CDATA[9]]></Website>
    </Lang_SRC>
    <Lang_DEST>
    <ProjectID>P000755</ProjectID>
    <agentID>1</agentID>
    <ProjectLang>CHN</ProjectLang>
    <ImplID>2</ImplID>
    <Name>impl 1</Name>
    <Address><![CDATA[2]]></Address>
    <City>3</City>
    <Country>4</Country>
    <Phone>5</Phone>
    <Fax>6</Fax>
    <Email>7</Email>
    <Website><![CDATA[10]]></Website>
    </Lang_DEST>
    </Project>


    Here is the Sql to get the xml..

    SELECT
    ( SELECT
    ImplProjectID ProjectID
    ,ImplProjectLang ProjectLang
    ,ProjectImplID ImplID
    ,ImplName Name
    ,ImplAddress [Address]
    ,ImplCity City
    ,ImplCountry Country
    ,ImplPhone Phone
    ,ImplFax Fax
    ,ImplEmail Email
    ,ImplWebsite Website
    FROM [OPSEXT].[ProjectImpAgency]
    WHERE [ImplProjectID] = @ProjectID
    AND [ImplProjectLang] = @SourceLang
    FOR XML PATH('Lang_SRC'),TYPE
    ) ,
    (SELECT
    ImplProjectID ProjectID
    ,ImplProjectLang ProjectLang
    ,ProjectImplID ImplID
    ,ImplName Name
    ,ImplAddress [Address]
    ,ImplCity City
    ,ImplCountry Country
    ,ImplPhone Phone
    ,ImplFax Fax
    ,ImplEmail Email
    ,ImplWebsite Website
    FROM [OPSEXT].[ProjectImpAgency]
    WHERE [ImplProjectID] = @ProjectID
    AND [ImplProjectLang] = @DestLang
    FOR XML PATH('Lang_DEST'),TYPE
    )
    FOR XML PATH('')
    ,ROOT('Result')


    <Result>
    <ProjectPROJECTID> here i want to add <Project ProjectID=755 AgentID= 1 >
    <Lang_SRC>
    <ProjectID>P000756</ProjectID>
    <ProjectLang>ENG</ProjectLang>
    <ImplID>6</ImplID>
    <Name>Impl 1</Name>
    <Address>2</Address>
    <City>3</City>
    <Phone>5</Phone>
    <Fax>6</Fax>
    <Email>7</Email>
    <Website>9</Website>
    </Lang_SRC>
    <Lang_DEST>
    <ProjectID>P000756</ProjectID>
    <ProjectLang>CHN</ProjectLang>
    <ImplID>8</ImplID>
    <Name>impl 2</Name>
    <Address>this is a book &lt; Pen</Address>
    <City>3</City>
    <Phone>5</Phone>
    <Fax>6</Fax>
    <Email>7</Email>
    <Website>10</Website>
    </Lang_DEST>
    </ProjectPROJECTID>
    </Result>

  2. #2
    Join Date
    Jan 2011
    Posts
    14
    What exactly do you need help with? Is the SQL statememnt you posted working?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •