Limit # of Recs in Foregin Table

  • If business logic only allows having n items of information for a specific relationship, how would we go about enforcing that? Would we use an OnInsert trigger that counts occurrences and fails when record count is over?

    I used addresses for an individual, we could expand that relationship, say one person could only have 3 SSN records? Where you have your 'Person', 'Address', and 'SSN' tables where the personID is the key in each of the other two tables.

    If anybody has any ideas on the subject or has found any papers on it...

    Thanks!

    Bill.

  • There are a couple of ways you could manage that.

    One would certainly be an on-insert trigger. Another would be to handle it in the insert proc. More likely, you'd limit it in the application, not the database. If there are only two fields for entering addresses on the screen, you can only really enter two addresses.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply