Hi @atothep,
Certainly the isolation level will make a difference to what a particular session can see, and the help documentation on the DB Transaction Start mentions this, but if you have a single connection to a database (any SQL database that is configured to follow standard mechanism for transactions), then ANY query or other action that takes place prior to a commit will be within the same transaction.
The flow variable link between the DB Query Reader and the DB Transaction End ensures that the DB Query Reader’s query will be executed before the transaction ends. If it were on a different session it would be outside of the transaction, but to be on a different session it would have to have had its session created by a different Microsoft SQL Server Connector.
You should be able to test this theory by adding a second MS SQL Database connector and add to it a DB Query Reader of its own. Manually execute your existing transaction up to the (existing) DB Query Reader but not the DB Transaction End.
Manually execute the second DB Connector and DB Query Reader (configured to run the same query as the first). Are the results of the two DB Query Readers the same or different?
You could also try adding a DB SQL Executor after the DB Query Reader and issuing a Rollback and then execute a further DB Query Reader to see if there are differences between the DB Query Reader which I believe is inside the transaction, and the (new) one that follows.
In all of this I’m making an assumption that on your database you don’t have things such as auto-commit turned on (e.g. IMPLICIT TRANSACTIONS turned off in SQL Server and that ) or any other settings that might affect the way it works.
I have now read that SQL Server has settings ALLOW_SNAPSHOT_ISOLATION and READ_COMMITTED_SNAPSHOT which if set would potentially mean that a query within a transaction will see the data as it was prior to the start of the transaction. I’ve never used that setting and to be honest find that quite a scary concept in that you cannot review the changes you’ve just made before committing. If you have those turned on, then in theory (I’ve never tried it) the DB Query Reader wouldn’t see the modifications.
If in doubt, I would think you could add DB SQL Executor before the DB Transaction Start and issue a
SET IMPLICIT_TRANSACTIONS ON /* ensure no autocommit */
and
SET TRANSACTION ISOLATION LEVEL READ COMMITTED
All that being said, from what you say, I believe you are wanting to ensure that the DB Query Reader can read the data that has been modified by the DELETE, INSERT and MERGE that has taken place.
When you execute the DB Query Reader (but not the DB Transaction End) Are you saying that the DB Query Reader (as placed in your flow above) isn’t seeing those changes, and that if you were to place a second DB Query Reader after the DB Transaction End, that it would be returning different results?