1. Learn
  2. /
  3. Courses
  4. /
  5. Writing Functions and Stored Procedures in SQL Server

Connected

Exercise

Your very own TRY..CATCH

Alter dbo.cuspRideSummaryDelete to include an intentional error so we can see how the TRY CATCH block works.

Instructions

100 XP
  • Incorrectly assign @DateParm a nvarchar(30) data type instead of a date.
  • Include @Error as an optional OUTPUT parameter.
  • Include the DELETE statement within the BEGIN TRY...END TRY block.
  • Concatenate the ERROR_NUMBER(), ERROR_SEVERITY(), ERROR_STATE(), ERROR_MESSAGE(), ERROR_LINE() within the BEGIN CATCH...END CATCH block and SET to @Error.