Session Ready
Exercise

Concatenating the message

You need to prepare a script to select all the information about the members from the staff table using a given first_name.

If the select statement doesn't find any member, you want to throw an error using the THROW statement. You need to warn there is no staff member with such a name.

Instructions
100 XP
  • Assign to @my_message the concatenation of 'There is no staff member with ', with the value of @first_name and with ' as the first name.'.
  • Use THROW with 50000 as the error number, @my_message as the message parameter, and 1 as the state.
  • Replace the name 'Pedro' in the DECLARE statement at the beginning with a name that doesn't exist (e.g. 'David') and click Run Code (not Run Solution). You will see the error.
  • Change again the name to 'Pedro' and run the code without errors.