I apologize in advance if this is the wrong board for this. I will move it if asked. Image should be attached for my table layout.
Maybe someone can help me. I am trying to make a simple sql database in Visual Studio 2013 for a class project. Three of my tables that my question address are as in the picture.
I have a fourth table that uses CustomerID, HIN, and BoatID as foreign keys to make a printable temporary docking tag with information from those three table.
Here is what I'm trying to accomplish. I need the code for a trigger in the 4th table that when a user enters a BoatID from the BoatInfo table and a DockID from the DockInfo table it compares the HeightInFeet field from DockInfo with the HeightInFeet field from BoatInfo to make sure that the first is taller than the second and so the boat will fit in the dock. If the boat will not fit I want the database to reject that entry. An appropriate error message is not necessary for the purposes of the class but might make it look shinier if you want to throw that in too.
I know this trigger is probably fairly simple to write but I am not very good in SQL and am not trying very hard as this class really has nothing to do with my chosen career path.