I am getting the below error when I am running my dynamic SQL in my begin transaction. Msg 3910, Level 16, State 2, Line 1Transaction context in use by another session.Below is my sample CodeBegin TransactionDeclare @sql nvarchar(max), @ParmDefinition nvarchar(500), @table varchar(100)set @table ='CompServer.Comp_Sandbox.dbo.test_Table'set @sql = 'delete from ' + @table + ' Where Id=1'exec sp_executesql @sqlCommit Transaction
I am able to get rid of the error when I am commenting my begin and commit statements or If I have my table name only with DB name but not server name i.e. set @table ='Comp_Sandbox.dbo.test_Table'How could I fix this error by having the server name with full path and inside the begin transactionThanks,