Answered XQuery FOR XML

  • Wednesday, April 25, 2012 2:37 PM
     
     
    Hi,

    I want the following output using sql server xquery for xml (auto / expilicit / etc.)



    <rss xmlns:g="http://base.google.com/ns/1.0" version="2.0">
    <channel>
      <item>
        <g:id>SLNI0708</g:id>
        <title><![CDATA[Salwar Kameez Multicolor Cotton Suit]]></title>
        <description><![CDATA[Colorful and beautiful cotton top with white color embroidery and sequins work, Comes with a parrot green color plain bottom. Multicolor worked chiffon dupatta, comes along with the set. FOR MAXIMUM SIZE PLEASE GOTO ADD TO CART, SLEEVE TYPE : SHORT SLEEVES, BOTTOM STYLE : CHUDI OR SALWAR. Due to various types of lightings & flash used while photo shoot the color shade of the product may vary. The]]></description>
        <g:google_product_category><![CDATA[Apparel & Accessories > Clothing > Dresses]]></g:google_product_category>
        <g:product_type><![CDATA[Salwar Kameez]]></g:product_type>
        <link><![CDATA[/salwar-kameez/cotton-in-vogue/multicolor-cotton-suit-p-slni0708.html?utm_source=Google-Base&utm_medium=Referral&utm_campaign=slni0708]]></link>
        <g:image_link><![CDATA[/images/37939.jpg]]></g:image_link>
        <g:additional_image_link><![CDATA[/images/prd_img_b/33057.jpg]]></g:additional_image_link>
        <g:condition>new</g:condition>
        <g:availability><![CDATA[in stock]]></g:availability>
        <g:price><![CDATA[86]]></g:price>
      </item>
    </channel>
    </rss>

    Thanks in Advance

    Prathees kumar C

All Replies

  • Wednesday, April 25, 2012 2:56 PM
     
      Has Code

    So where do you have a concrete problem?

    E.g.

    DECLARE @Rss NVARCHAR(MAX) = '
    <rss xmlns:g="http://base.google.com/ns/1.0" version="2.0">
    <channel>
      <item>
        <g:id>SLNI0708</g:id>
        <title><![CDATA[Salwar Kameez Multicolor Cotton Suit]]></title>
        <description><![CDATA[Colorful and beautiful cotton top with white color embroidery and sequins work, Comes with a parrot green color plain bottom. Multicolor worked chiffon dupatta, comes along with the set. FOR MAXIMUM SIZE PLEASE GOTO ADD TO CART, SLEEVE TYPE : SHORT SLEEVES, BOTTOM STYLE : CHUDI OR SALWAR. Due to various types of lightings & flash used while photo shoot the color shade of the product may vary. The]]></description>
        <g:google_product_category><![CDATA[Apparel & Accessories > Clothing > Dresses]]></g:google_product_category>
        <g:product_type><![CDATA[Salwar Kameez]]></g:product_type>
        <link><![CDATA[/salwar-kameez/cotton-in-vogue/multicolor-cotton-suit-p-slni0708.html?utm_source=Google-Base&utm_medium=Referral&utm_campaign=slni0708]]></link>
        <g:image_link><![CDATA[/images/37939.jpg]]></g:image_link>
        <g:additional_image_link><![CDATA[/images/prd_img_b/33057.jpg]]></g:additional_image_link>
        <g:condition>new</g:condition>
        <g:availability><![CDATA[in stock]]></g:availability>
        <g:price><![CDATA[86]]></g:price>
      </item>
    </channel>
    </rss>
    ';
    
    SELECT  @Rss;

  • Wednesday, April 25, 2012 3:42 PM
    Answerer
     
     Answered
    • Marked As Answer by Pratheeskkvi Thursday, April 26, 2012 6:15 AM
    •  
  • Thursday, April 26, 2012 6:16 AM
     
     
    Thanks lot Jacob. My problem was solved.