SQL Server - Error Msg 9400, Level 16, State 1, Line

We will get this error when we are trying to query XML in SQL Server. 
Each and every XML node should have closing node like this <element>....</element>. XML will become invalid when it has backslash "\" instead of forward slash "/"

Below error will be throwed  when input XML doesn't have proper enclosing node :

Msg 9400, Level 16, State 1, Line 1
XML parsing: line 6, character 5, unexpected end of input

To resolve the error:

Check all the XML tags have proper enclosing tags to fix / avoid this error.

Note : This error can also be encountered under various other scenarios. I will keep updating this article.

See Also:

No comments: