Nested stored procedures containing TRY CATCH ROLLBACK pattern?

This is our template (error logging removed) This is designed to handle Paul Randal’s article “No such thing as a nested transaction in SQL Server” Error 266 Trigger Rollbacks Explanations: all TXN begin and commit/rollbacks must be paired so that @@TRANCOUNT is the same on entry and exit mismatches of @@TRANCOUNT cause error 266 because … Read more

Integer division in sql server

In the first you are getting the result of two integers and then casting the result as DECIMAL(9,2). In the second you’re just dividing two integers and that’s expected. If you cast one of the integers as a decimal BEFORE you do the division, you’ll get a decimal result. SELECT 151/CAST(6 AS DECIMAL (9,2))