SO_SalesOrderHistoryDetail has records with a null SalesOrderNo

I've noticed that we have just over 14,000 records in the SO_SalesOrderHistoryDetail table where the SalesOrderNo field is null.  This is causing some issues with trying to do a copy into a MySQL database due to the Primary Key not accepting null values.  There are no records in the SO_SalesOrderHistoryHeader table that have a null SalesOrderNo so I have no idea where these came from.

I need to find a way to get rid of them.  I've worked with Sage support to try and figure it out and we've tried a variety of things from rebuilding the key files to some command line utility they ran that I've never seen before and we can't figure it out.  We can easily see the records through DFDM, but manually deleting 14,000 of them one at a time is not an option.

Is there any other method of finding and removing these all at once?  I'm open to anything.  Using Business Objects, trying Visual Integrator, using some other method we can't seem to think of...

Has anyone ran into this before, or have any ideas on how to fix it?

This is for Sage 100 Advanced 2020.

Parents
  • 0

    One thing I would try first in a test company might be to export all of the non null records for all fields into a text file, and then rename the file and import only the non-null records.  Be aware that if you have quotes, single quotes and commas in your descriptions this could be a problem on the import.

    Depending on how you are inserting into MySQL, you could also filter out those records where the SalesOrderNo is null, if it is in fact null.

  • 0 in reply to mhainesalt

    I could easily fix it by stripping those entries out of a text file, but that is not how the import is being done.  It is also not a one off, it runs multiple times a day so having to interact with it every time would not be feasible.  I just need a way to clean them out of Sage completely since their broken records without a header anyways.

Reply
  • 0 in reply to mhainesalt

    I could easily fix it by stripping those entries out of a text file, but that is not how the import is being done.  It is also not a one off, it runs multiple times a day so having to interact with it every time would not be feasible.  I just need a way to clean them out of Sage completely since their broken records without a header anyways.

Children
  • 0 in reply to justinp

    I am actually suggesting that you correct the Sage table in a test company by exporting all the records, renaming and manually reinitializing the table again in the test company and then reimporting it back into Sage without the null records.   If this fixes this in a test environment and you have a good backup if it doesn't this could be a work around in a non SQL environment.