When running upgrade scripts you get errors in the Core database scripts similar to the following:
Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon.Incorrect syntax near the keyword 'WITH'.
Errors in upgrade log are due to compatibility level of the database. With sql2016 or later you must run the DB in compatibility level 130 or higher.
Change the compatibility level to 130 or higher.
Before attempting this change on a Production environment please consult with Bentley ALIM support to confirm that it will not impact production environment.
The following Link describes how to change compatibility level: https://learn.microsoft.com/en-us/sql/relational-databases/databases/view-or-change-the-compatibility-level-of-a-database?view=sql-server-ver16