.sp_send_dbmail sending an XML File dashes in front of -<Label> ??

  • Hi

    using .sp_send_dbmail to email an xml file

    New at XML files, but my sample to recreate looks like this:

    <CLUB>

    <REFERRAL>

    <field1>6.6.11</field1>

    <field3>Ongoing</field3>

    File looks ok (so far)

    except I have dashes in front

    - <CLUB>

    - <REFERRAL>

    <field1>6.6.11</field1>

    <field3>Ongoing</field3>

    Thanks

    Joe

  • To get rid of those dashes you could do something like this:

    DECLARE @x XML,

    @x1 varchar(1000)='

    - <CLUB>

    - <REFERRAL>

    <field1>6.6.11</field1>

    <field3>Ongoing</field3>

    - </REFERRAL>

    - </CLUB>';

    SET @x1=REPLACE(@x1, '- <','<');

    SET @x=CAST(@x1 AS xml);

    SELECT @x

    I don't know where those are coming from but I know that you will get those if you copy/paste XML code that is opened in Internet Explorer.

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply