From the course: Complete Guide to Advanced SQL Server

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Add error handling and test the system: Part 2

Add error handling and test the system: Part 2 - SQL Server Tutorial

From the course: Complete Guide to Advanced SQL Server

Add error handling and test the system: Part 2

We scroll down here and take a look at our last test that I have, and that's to test it with an invalid player ID. So this one's a little bit interesting. Insert into game-score events. So we'll try and enter a player ID and a score. But this time instead of entering a score for player 1 or 2, let's try and enter a score for a player number five, which I know is not present in the database. At least it's not present in the players table. But if I try and insert this into the score events table, there's nothing really preventing me right now from doing that. So it tells me that the current global score has been recorded, score events have been recorded, player total score has been updated. So it went through all of my triggers, but I now have an invalid row in my table. We select all three tables again, see what happened. So we've got that new entry in the events table. So player number five scored 99 points. But if we look in the players table, there actually is no player number five.…

Contents