Using XMLDATA with FOR XML PATH error

  • I hope I can explain my problem.

    I have some T-SQL that generates HTML code by using the FOR XML PATH functionality. Once the HTML is built, I am using the following T-SQL to convert it to XML so I am not limited by the output

    SELECT @vHTML AS [processing-instruction(x)]

    FOR XML PATH('')

    where @vHTML is varchar(MAX)

    Now, when I run my code in VB.NET and use the ExecuteXMLReader() command, I get nothing back into the XML Reader. I noticed that I needed the XMLDATA directive also, but when I add it, I get the following error

    Msg 6860, Level 16, State 1, Line 247

    FOR XML directive XMLDATA is not allowed with ROOT directive or row tag name specified.

    Does anyone have any idea how I can get this to work? I would appreciate it.

  • just a curiosity?

    may i know why are you using processing instruction?

    for your vb.net code

    Every rule in a world of bits and bytes, can be bend or eventually be broken
    MyBlog About Common dialog control
    A Visualizer for viewing SqlCommand object script [/url]

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

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