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

  • 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.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon