Inherited a 2011 CRM that had some add-on's installed and "removed" but when I went to do update, I got a bunch of SP warnings which I was told by boss was OK. Ran on with install which completed the binary parts but failed when it started the SQL components. Key text from install log below.
10:35:20| Info| File = Scripts\Constants.sql, Message = Add required database constants to mimic enumerations, Target = All 10:35:20| Info| CrmAction execution time; InstallConfigDatabaseAction; 00:00:02.8744112 10:35:20| Error| Installer Complete: ConfigDBInstaller - Error encountered 10:35:20|Warning| Error reported while configuring _Deployment. Attempting rollback 10:35:20| Info| ConfigDBInstaller: Beginning uninstall operation 10:35:20| Info| ConfigDBInstaller: Uninstall completed 10:35:20| Error| Install exception.System.Exception: Action Microsoft.Crm.Setup.Server.InstallConfigDatabaseAction failed. ---> System.Data.SqlClient.SqlException: Incorrect syntax near 'MERGE'. Incorrect syntax near the keyword 'AS'. Incorrect syntax near 'D'. Incorrect syntax near ')'.
I checked the SQL and did see that there was an alias for the CTE which I removed but did not have time to run and see if it solved the issue. Google or Bing searches did not turn up likely results so figuring one of the old "add-ins" might have broken something. When boss tried a while ago he got same error and commented out the lines and upgrade failed so trying to do better.
Thanks