In Spanner batched commands are executed sequentially in the order they are received.
If one command fails then the following commands won't be executed.
This exception contains the error code and error message corresponding to the command that failed.
It also contains the number of rows modified by each of the commands that executed successfully.
Properties
SuccessfulCommandResults
public IEnumerable<long> SuccessfulCommandResults { get; }
Returns the affected rows for each of the batch commands that executed succesfully.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eSpannerBatchNonQueryException\u003c/code\u003e class represents an error that occurs during batch non-query operations in a Spanner database.\u003c/p\u003e\n"],["\u003cp\u003eThis exception class inherits from \u003ccode\u003eSpannerException\u003c/code\u003e and implements \u003ccode\u003eISerializable\u003c/code\u003e, providing detailed error information and serialization capabilities.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of the \u003ccode\u003eSpannerBatchNonQueryException\u003c/code\u003e documentation is version 5.0.0-beta05, with various other versions down to 3.5.0 available for reference.\u003c/p\u003e\n"],["\u003cp\u003eIf one command fails during a batch execution, subsequent commands will not run, and this exception will contain the error information.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eSuccessfulCommandResults\u003c/code\u003e property provides a collection of row counts for commands that executed successfully in a batch.\u003c/p\u003e\n"]]],[],null,["# Google.Cloud.Spanner.Data - Class SpannerBatchNonQueryException (5.1.0)\n\nVersion latestkeyboard_arrow_down\n\n- [5.1.0 (latest)](/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerBatchNonQueryException)\n- [5.0.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/5.0.0/Google.Cloud.Spanner.Data.SpannerBatchNonQueryException)\n- [4.6.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/4.6.0/Google.Cloud.Spanner.Data.SpannerBatchNonQueryException)\n- [4.5.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/4.5.0/Google.Cloud.Spanner.Data.SpannerBatchNonQueryException)\n- [4.4.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/4.4.0/Google.Cloud.Spanner.Data.SpannerBatchNonQueryException)\n- [4.3.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/4.3.0/Google.Cloud.Spanner.Data.SpannerBatchNonQueryException)\n- [4.2.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/4.2.0/Google.Cloud.Spanner.Data.SpannerBatchNonQueryException)\n- [4.1.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/4.1.0/Google.Cloud.Spanner.Data.SpannerBatchNonQueryException)\n- [4.0.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/4.0.0/Google.Cloud.Spanner.Data.SpannerBatchNonQueryException)\n- [3.15.1](/dotnet/docs/reference/Google.Cloud.Spanner.Data/3.15.1/Google.Cloud.Spanner.Data.SpannerBatchNonQueryException)\n- [3.14.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/3.14.0/Google.Cloud.Spanner.Data.SpannerBatchNonQueryException)\n- [3.13.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/3.13.0/Google.Cloud.Spanner.Data.SpannerBatchNonQueryException)\n- [3.12.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/3.12.0/Google.Cloud.Spanner.Data.SpannerBatchNonQueryException)\n- [3.11.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/3.11.0/Google.Cloud.Spanner.Data.SpannerBatchNonQueryException)\n- [3.10.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/3.10.0/Google.Cloud.Spanner.Data.SpannerBatchNonQueryException)\n- [3.9.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/3.9.0/Google.Cloud.Spanner.Data.SpannerBatchNonQueryException)\n- [3.8.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/3.8.0/Google.Cloud.Spanner.Data.SpannerBatchNonQueryException)\n- [3.7.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/3.7.0/Google.Cloud.Spanner.Data.SpannerBatchNonQueryException)\n- [3.6.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/3.6.0/Google.Cloud.Spanner.Data.SpannerBatchNonQueryException)\n- [3.5.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/3.5.0/Google.Cloud.Spanner.Data.SpannerBatchNonQueryException) \n\n public class SpannerBatchNonQueryException : SpannerException, ISerializable\n\nReference documentation and code samples for the Google.Cloud.Spanner.Data class SpannerBatchNonQueryException.\n\nRepresents an error communicating with the Spanner database when executing\nbatch non query operations. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e [Exception](https://learn.microsoft.com/dotnet/api/system.exception) \\\u003e [SpannerException](/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerException) \\\u003e SpannerBatchNonQueryException \n\nImplements\n----------\n\n[ISerializable](https://learn.microsoft.com/dotnet/api/system.runtime.serialization.iserializable) \n\nInherited Members\n-----------------\n\n[SpannerException.ErrorCode](/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerException#Google_Cloud_Spanner_Data_SpannerException_ErrorCode) \n[SpannerException.IsRetryable](/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerException#Google_Cloud_Spanner_Data_SpannerException_IsRetryable) \n[SpannerException.RecommendedRetryDelay](/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerException#Google_Cloud_Spanner_Data_SpannerException_RecommendedRetryDelay) \n[SpannerException.RpcException](/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerException#Google_Cloud_Spanner_Data_SpannerException_RpcException) \n[Exception.GetBaseException()](https://learn.microsoft.com/dotnet/api/system.exception.getbaseexception) \n[Exception.GetObjectData(SerializationInfo, StreamingContext)](https://learn.microsoft.com/dotnet/api/system.exception.getobjectdata) \n[Exception.GetType()](https://learn.microsoft.com/dotnet/api/system.exception.gettype) \n[Exception.ToString()](https://learn.microsoft.com/dotnet/api/system.exception.tostring) \n[Exception.Data](https://learn.microsoft.com/dotnet/api/system.exception.data) \n[Exception.HelpLink](https://learn.microsoft.com/dotnet/api/system.exception.helplink) \n[Exception.HResult](https://learn.microsoft.com/dotnet/api/system.exception.hresult) \n[Exception.InnerException](https://learn.microsoft.com/dotnet/api/system.exception.innerexception) \n[Exception.Message](https://learn.microsoft.com/dotnet/api/system.exception.message) \n[Exception.Source](https://learn.microsoft.com/dotnet/api/system.exception.source) \n[Exception.StackTrace](https://learn.microsoft.com/dotnet/api/system.exception.stacktrace) \n[Exception.TargetSite](https://learn.microsoft.com/dotnet/api/system.exception.targetsite) \n[Exception.SerializeObjectState](https://learn.microsoft.com/dotnet/api/system.exception.serializeobjectstate) \n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone)\n\nNamespace\n---------\n\n[Google.Cloud.Spanner.Data](/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data)\n\nAssembly\n--------\n\nGoogle.Cloud.Spanner.Data.dll\n\nRemarks\n-------\n\nIn Spanner batched commands are executed sequentially in the order they are received.\nIf one command fails then the following commands won't be executed.\nThis exception contains the error code and error message corresponding to the command that failed.\nIt also contains the number of rows modified by each of the commands that executed successfully.\n\nProperties\n----------\n\n### SuccessfulCommandResults\n\n public IEnumerable\u003clong\u003e SuccessfulCommandResults { get; }\n\nReturns the affected rows for each of the batch commands that executed succesfully.\n\nExtension Method\n----------------\n\n[TransientFaultDetector.IsTransientSpannerFault(Exception)](/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.TransientFaultDetector#Google_Cloud_Spanner_Data_TransientFaultDetector_IsTransientSpannerFault_System_Exception_)"]]