finding the invalid character

GanSea 96 Reputation points

In my SSIS project in Visual studio 2019, I am receiving this error.

An error occurred with the following error message: "System.Xml.XmlException: ' ', hexadecimal value 0x03, is an invalid character. Line 44, position 4.

I believe I have found the correct line with the following query in Microsoft SQL Server Management Studio

SELECT id, name, ROW_NUMBER() OVER (ORDER BY name) AS RowNumber
FROM MyTable

However, after checking the whole row I couldn’t find the invalid character.

How can I find position 4 on line 44 in Microsoft SQL Server Management Studio?

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
8,503 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
1,846 questions
{count} votes

Accepted answer
  1. GanSea 96 Reputation points

    I found the invalid character, by selecting all the records in the table, and saving them as an CSV file.

    Then I open the CSV file in Notepad++ and set show symbols to show all characters.

    Then I was able to find the record with the invalid character.

    Thank you all for the help

    No comments

2 additional answers

Sort by: Most helpful
  1. Erland Sommarskog 67,721 Reputation points Microsoft MVP

    As Viroel suggests, the error message does not refer to a row in your table. Rather the error message refers to a specific XML document in your table.

    You may be able to find the document with this query:

    SELECT * FROM tbl
    WHERE charindex(nchar(3), cast(xmldoc AS nvarchar(MAX)) COLLATE Latin1_General_BIN2) > 0
    No comments

  2. Monalv-MSFT 5,686 Reputation points

    Hi @GanSea ,

    Could you please share the components in your ssis package?

    Could you please share the example results of the query "SELECT id, name, ROW_NUMBER() OVER (ORDER BY name) AS RowNumber FROM MyTable" ?

    The following link will be helpful:
    HEXADECIMAL VALUE 0X03 is an invalid character

    Best Regards,

    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    No comments