Section 1
True/False Questions
(10 Marks, 1 mark each)
1. A stored procedure in SQL Server can contain both DDL and DML statements.
2. A trigger can be executed directly using the EXEC command.
3. The TRY...CATCH block in SQL Server allows handling of runtime errors gracefully
within a procedure.
4. The BEGIN TRANSACTION statement must always be followed by either a COMMIT
or ROLLBACK.
5. Variables declared within a stored procedure remain accessible even after the
procedure ends.
6. An AFTER trigger is executed after the SQL statement that caused it is completed.
7. Using an INSTEAD OF trigger, you can completely replace the default insert, update,
or delete behavior.
8. The IF... ELSE construct can be used inside a stored procedure to control which SQL
statements are executed.
9. When an error occurs inside a TRY...CATCH block, the transaction automatically
commits.
10. A stored procedure cannot call another stored procedure from within it.
Section 2 - Practical (90 Marks)
Use SQL Server Management Studio {SSMS) on your computer to complete this section.
Instructions:
Copy and paste your final code into the designated space for each question on eLearning.
Ensure you also keep a copy of your work in Notepad as a backup in case of any technical issues.
Use the scenario and table provided below to answer all the questions.
Scenario:
The Lecturer-Student Consultation Management System allows students to schedule and
manage consultations with lecturers about academic issues in the courses they are studying.
The system should capture lecturer and student details, consultation dates, times, topics, and
statuses.
CREATE TABLE dbo.CONSULTATION (
Consultation ID INT PRIMARY KEY,
LecturerName NVARCHAR(l00),
2