SSIS reports invalid character for cast specification

I am getting this error message after the package runs for a few minutes.
0x80004005  Description: "Invalid character value for cast specification.".

The script in my package has many lines like this:
      ,cast(RTRIM(LTRIM(d.ACTNUMST)) as nvarchar(35)) as AccountString

All the conversions are trying to strip away blanks. They are all nvarchar and there no conversions to float or int. I have tried looking for blanks in my database and there are plenty of them but that should not cause this error. How can I track down exactly which row is causing this error so I can root out the bad data?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dung DinhDBA and Business Intelligence DeveloperCommented:
Not sure about your situation, but you can configure the error lines to a table or csv file to for tracking down the issue. Assume that you're using Derived Column component in Data Flow.

Open Derived Column Transformation Editor --> Click on  Configure Error Output. At Error column, select Redirect Row for ACTNUMST.

Vikas GargAssociate Principal EngineerCommented:

If you are getting this error while loading data to the destination in Data flow Task.

Then you can set the destination property to redirect rows to error output rather then failing the package.
And at the error output of the destination in Data Flow you can connect sql table with all nvarchar or to a text file.
At the error row output you will also have error code with that you can come to know that the error is which these limited rows.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rwheeler23Author Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.