finding the invalid character

GanSea 96 Reputation points
2020-09-12T06:50:21.727+00:00

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 Integration Services
SQL Server | Other
SQL Server | Other

Additional SQL Server features and topics not covered by specific categories


Answer accepted by question author

GanSea 96 Reputation points
2020-09-17T07:28:05.31+00:00

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

Was this answer helpful?

0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Erland Sommarskog 135.7K Reputation points MVP Volunteer Moderator
    2020-09-12T12:23:44.187+00:00

    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
    

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

  2. Monalv-MSFT 5,926 Reputation points
    2020-09-14T06:40:09.327+00:00

    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,
    Mona


    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.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.