push_pin
lock
Database Mirroring fails with exception: Must declare the scalar variable "@tablename".
DatabaseMirroring fails with SQL Server 2022 (CU13). Works: Microsoft SQL Server 2022 (RTM-GDR) (KB5046057) - 16.0.1130.5 (X64) Sep 25 2024 Fails: Microsoft SQL Server 2022 (RTM-CU13) (KB5036432) - 16.0.4125.3 (X64) May 1 2024 One of the versions in between those releases added a change that makes the parameters case-sensitive and our code use @tablename and @tableName which results in the following exception. We have issued a fix in the offending library, but it will take a little more time to refresh the SuperOffice.Crm.Online.Mirroring package, and the code on the GitHub repository . Therefore, until further notice, we recommend you use SQL Server 2022 RTM GDR or earlier releases for Database Mirroring. We apologize for any inconvenience. Message: Exception: Must declare the scalar variable "@tablename". at at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader() at SuperOffice.Online.Mirroring.MirroringClientImplementation.GetLocalTableInfo(String connectionString, String contextIdentifier, String tableName) in C:\Agent1\_work\3\s\Source\SuperOffice.Online.Mirroring\MirroringClientImplementation.cs:line 267 at SuperOffice.Online.Mirroring.MirroringClientImplementation.TableSchemaImplementation(String contextIdentifier, TableSchemaInfo[] tables, String clientState) in C:\Agent1\_work\3\s\Source\SuperOffice.Online.Mirroring\MirroringClientImplementation.cs:line 111 at SuperOffice.Online.Mirroring.MirroringClientService.TableSchema(TableSchemaRequest request) in C:\Agent1\_work\3\s\Source\SuperOffice.Online.Mirroring\MirroringClientService.cs:line 43 Type: SuperOffice.Online.Processing.Agents.DataMirroring.MirrorException at SuperOffice.Online.Processing.Agents.DataMirroring.MirroringClientServiceClient.TableSchema(TableSchemaInfo[] tableInfos) at SuperOffice.Online.Processing.Agents.DataMirroring.DataMirroringAgent.ProcessCustomerAsync(IServiceScope scope, CustomerTask task, CancellationToken cancellationToken) in /_/Source/SuperOffice.Online.Processing/Agents/DataMirroring/DataMirroringAgent.cs:line 279