Skip to content

Query regarding error behaviour with SqlBatch #3273

Open
@rkaushik15

Description

@rkaushik15

Hello!

I had some queries regarding error handling with SqlBatch.

From my local tests I can observe the following behavior:

With default case - SqlBatch.Transaction is null, in case any statement in the batch fails, the changes from non-failing DMLs in the batch get committed.
QUESTION:
Is my understanding correct? Does the SqlBatch.Execute* API internally create a local transaction to rollback or commit the changes?

If SqlBatch.Transaction is NOT null, and a statement in the batch fails, even the non-failing DML changes are not committed.
QUESTION:
Is my understanding correct? Does the provider automatically rollback the changes in case an error is encountered? And will it automatically commit when no errors are there?

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area\DocumentationUse this for issues that requires changes in public documentations/samples.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions