by Mohsen Farahi.
Hi Mike,
I had this issue upgrading to 2.4.2 and 2.3.5 from 2.3.2 and finally worked out that the upgrade script won't work on MS SQL unless if you run the following query before comitting the upgrade. (Original post: https://moodle.org/mod/forum/discuss.php?d=224238
UPDATE mdl_course_sectionsSET sequence=N'' WHERE sequence is null;
I checked the courses which will be affected by this query and they are all the empty courses. This query basically replace the database Null values with empty strings.
Try this and let me know if it has been of any help.
Regards,
Mohsen