SQL Server TRY CATCH FINALLY

Ich habe ein Szenario, in dem ich etwas Ähnliches wie @ brauch.NET's try-catch-finally block.

ei meinem Versuch werde ichCREATE a #temp table, INSERT data to it & verarbeite andere Datensätze basierend auf#temp.

AufCATCH dannRAISERROR. Ist es möglich ein @ zu habFINALLY block toDROP #temp? Unten ist der Pseudocode:

BEGIN TRY

  CREATE TABLE #temp
  (
     --columns
  )
  --Process data with other data sets

END TRY
BEGIN CATCH

  EXECUTE usp_getErrorMessage

END CATCH
BEGIN FINALLY

  DROP TABLE #temp

END FINALLY

Antworten auf die Frage(4)

Ihre Antwort auf die Frage