how to create a constraint/trigger

  • Assume I have following three seperate employee tables: Accountant, Manager and Administrator. How can I add a constraint/Trigger (using SS_number) to make sure a employee can only work at one capacity (i.e. someone cannot be both an accountant and a manager)?

  • You should not use three different tables.

    Put them in one table and add a column with their capacity.

    You can add a table with the possible capacities and add a foreign key from your persons table to this table.

    Please read articles and books about normalisation of relational databases.

    Erik.

    P.S. I don't think this is the right forum to post this question.

  • Yes, Erik is right, this might be a good start http://www.sqlservercentral.com/columnists/bkelley/normalization.asp .

    And, yes, there are more appropriate forum categories like T SQL or General (works always

    But unfortunately we can't move threads right now.

    Frank

    http://www.insidesql.de

    http://www.familienzirkus.de

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

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

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