T-SQL Error Resolution Quiz

5 questions Pass: 70% +25 pts (50 with Pro)

Quiz covering Resolve Errors

What you'll be asked

  1. Which T-SQL construct is used to capture and handle errors in a block of code, similar to try-catch blocks in other programming languages?
  2. When using a TRY...CATCH block, which function should you call to retrieve the specific error message text that occurred?
  3. You are troubleshooting a stored procedure that fails intermittently. Which system view or function is most useful for identifying the exact line number where an error occurred within a CATCH block?
  4. If you want to manually raise an error in T-SQL that stops execution and jumps to the CATCH block, which command should you use?
  5. You have a transaction inside a TRY block. If an error occurs, the transaction enters an uncommittable state. What is the correct way to check if a transaction is active and uncommittable before attempting to roll it back in the CATCH block?

Answers and explanations come after you submit.