Home Forums SQL Server 2005 T-SQL (SS2K5) illegal xml character - how to find the offending row RE: illegal xml character - how to find the offending row

  • GSquared (12/15/2011)


    Another possibility occurs to me:

    Most "illegal XML character" errors I've run into have been ampersands ("&"). A few have been brackets. Since it's nvarchar(max), you can:

    select *

    from dbo.MyTable

    where MyNvarcharColumn like '%[%]%';

    That will give you rows that have an ampersand in the XML. Then you'll need to fix those rows, of course.

    Thanks again. Yes, I have tried a cursor -- I will post the code next after trying your search above.

    Interestingly, when I select only each column from the table along with the relevant id columns, I get no error. But when I encapsulate the column in a call to the function to extract the required XML element value, I get the error. I'm going to take a closer look at how the functions process the data and see where that leads.

    Thanks again,

    webrunner

    -------------------
    A SQL query walks into a bar and sees two tables. He walks up to them and asks, "Can I join you?"
    Ref.: http://tkyte.blogspot.com/2009/02/sql-joke.html