Results 1 to 3 of 3

Thread: Just an idea

  1. #1
    Join Date
    Feb 2004
    Location
    Alpine Califormia
    Posts
    1,789

    Unanswered: Just an idea

    what if I took this trigger and based it on a view rather then a table

    Code:
    CREATE TRIGGER TerminationUpdateTrigger ON EmployeeGamingLicense
    FOR UPDATE 
    AS
    INSERT INTO TERMINATION(Status,[TM #],LastName, FirstName, [SocialSecurityNumber], DateHired, Title)
    SELECT STATUS, [TM#], LASTNAME, FIRSTNAME, [SSN#], HIREDATE, JOBTITLE
    FROM Inserted
    WHERE STATUS = 'TERMINATED'

    Code:
    CREATE VIEW dbo.Update_Terminations
    AS
    SELECT STATUS, TM#, LASTNAME, FIRSTNAME, SSN#, HIREDATE, 
        JOBTITLE
    FROM dbo.EmployeeGamingLicense
    WHERE (STATUS = N'TERMINATED')
    Base the Trigger on this View rather then on the Table itself????

  2. #2
    Join Date
    Sep 2003
    Posts
    364
    Looks good to me. I'd rather use a view instead of a trigger and termination table.

  3. #3
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Absolutely. You should avoid creating tables that are subsets of other tables whenver possible.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •