Dynamics CRM 4 Rollup 8, Rollup 9 Error + Fix

Gayan Perera, 22 April 2010

Cannot insert the value NULL into column 'InvoiceNumber', table 'MDCRMDemO_MSCRM.dbo.InvoiceBase'; column does not allow nulls. UPDATE fails. Invalid length parameter passed to the SUBSTRING function.

Cannot insert the value NULL into column 'InvoiceNumber', table

This happened recently on a hosted server, just for fun I thought I'd see if I can find the sql script that's doing it.

  • Download rollup 8 or 9, I downloaded 8
  • Download & Install WinRAR
  • Extract rollup by right clicking the update exe -> Extract to ...
  • Go into the following extracted directory CRMv4.0-*-i386-Server-ENU\en\kb975995\install
  • Open up dbhotfix_9007.sql in notepad

You have couple of options, you can either comment out line 24 to line 49, or simply add another where clause to line 17 so that it doesn't select any records, eg: " AND 1=2", once that's done run crmupdatewrapper.exe.

You might see a similar error with Rollup 9 regarding timezones, do the same as above, find the sql script, comment it out or add a IF check so it doesn't try to insert the record twice.