Consider the following:
- sp_a contains an sp_executesql call to exec sp_b
- sp_b begins and commits a transaction, then immediately logs @@TRANCOUNT.
When I call sp_a manually from within SSMS, the trancount is 0. If I run an SSRS report that contains a dataset that queries the same stored procedure, the trancount is logged as 1.
Doing a T-SQL trace of the SSRS method shows a trace event for the stored procedure call that is identical to the one I did from SSMS.
Is there some behavior that could change based on the SSRS context? Like, an implicit transaction being opened for the dynamic sql call or something, or SSRS creating a transaction context outside of T-SQL?