The automatic site upgrade from Citrix Virtual Apps and Desktops 7.2402 LTSR (or an equivalent Cumulative Update like CU3) to 7.2507 LTSR failed in Citrix Studio. This occurred after successfully migrating the site database to a dedicated SQL Server 2022 instance, which was a prerequisite.
A phased approach was used to meet the SQL Server 2022 system requirement and validate the existing configuration:
Intermediate Upgrade: Successfully upgraded the Delivery Controller (DDC) and StoreFront (SF) to 7.2402.3 LTSR. Connectivity tests were successful.
Database Migration:
The existing database was backed up from the local SQL Server Express 2017 instance (hosted on the DDC).
The database was restored onto a new, dedicated SQL Server Express 2022 server.
Repointing: The DDC was successfully repointed to the new SQL Server 2022 database. Connectivity tests were successful.
The final step—upgrading the DDC and SF to 7.2507.0 LTSR—passed all prechecks but failed during the "Automatic site upgrade" phase.
Error Source: Citrix Studio
Failure Point: Executing SQL scripts to update the database schema (from version 7.41.100.0 to 7.45.100.0 for MachineCreation). The specific script causing the issue was part of the UpdateDatabaseScript PowerShell history.
Root Cause: A Microsoft SQL Server error indicating an issue with database command execution:
Outer Exception: Failed to upload database scripts
Inner Exception: ExecuteNonQuery failed for Database 'Citrix-Test'.
Deepest Inner Exception: Microsoft.Data.SqlClient.SqlException: 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.
In summary, the upgrade failed because a script containing a SQL statement with an "Incorrect syntax near the keyword 'with'" error could not be executed on the new SQL Server 2022 database instance.
SQL server 2022 should have same compatibility level configured
The automatic site upgrade was successful after updating its compatibility level to 160 (the highest available), as detailed in the Microsoft SQL Server documentation.
Automatic Site upgrade failure on Citrix studio when upgrading to 2507 LTSR using SQL server 2022