I have a scenario where I need something similar to .NET\'s try-catch-finally block.
.NET\'s try-catch-finally block.
On my try, I will CREATE a #temp table, INSERT
CREATE a #temp table
INSERT
Instead of creating a table you could just declare a table variable (which will automatically go away when the query ends).
BEGIN TRY DECLARE @temp TABLE ( --columns ) --do stuff END TRY BEGIN CATCH --do other stuff END CATCH