I am looking to select the output of the data that I plan to update if rolling back the data, and print out some details as per the code below. When I run the select it doesn't then return the PRINT commands after just the output of the SQL. Is this all related to the buffer data, sure obvious but just trying to find the best way to display the data and output of the PRINT statement.
IF (@debug = 1) -- If Chosen to update, then commit changes
COMMIT TRANSACTION TRAN1;
PRINT 'Site updated,Transaction committed'
ELSE -- If run in debug then rollback updates applied
select electrician,meteringactual,arrivalEnergyStatus,DepartureEnergyStatus from Appointments where id in (select appID from #CompleteTemp)
ROLLBACK TRANSACTION TRAN1;
PRINT 'No site data updated. Transaction rolled back'