The use of temporary tables for updates in SQLServer will fail if tempdb uses a different collation to the application db. Specifically, comparisons between the primary table columns and the temporary table columns fail.
It is unclear to me under what circumstances a temporary table is created, so I'm afraid no test case is attached. I do however attach modified versions of the following classes:
These resolve the issue, but the solution may not be the most optimal possible, as it involves intervention in a specific position (between the datatype declaration and any nullability clause)
SQLServer (All versions)
Fix to allow annotation to be varied depending on column type
Add column parameter to getCreateTemporaryTableColumnAnnotation
The older versions of the attachments should disregarded - they will cause a failure if any of the temporary table's columns is not of the *char variety.
As of 5.4.19 the bug is still there and prevent some update query to be executed as seen in
Is there a workaround for this bug?
I created a PR for it here: