How do I create a multiple-table check constraint?
The best place to enforce data integrity is the database. Rest assured that some developer, intentionally or not, will find a way to sneak inconsistent stuff into the database if you let them! Here’s an example with check constraints: CREATE FUNCTION dbo.SignupMismatches() RETURNS int AS BEGIN RETURN ( SELECT count(*) FROM Shift s LEFT JOIN … Read more