Trrigger problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • davidbronsky
    New Member
    • Feb 2008
    • 2

    Trrigger problem

    I have question about TRIGGERS.
    I have (4 example) VEHICLE_TABLE with VEHICLE_TYPE column and CAR_TABLE and TRUCK_TABLE also.
    I need TRIGGER for INSERT/UPDATE/DELETE who well read value of VEHICLE_TYPE column in VEHICLE_TABLE and if value of VEHICLE_TYPE is CAR he will execute
    INSERT/UPDATE/DELETE on CAR_TABLE and if value of VEHICLE_TYPE column in VEHICLE_TABLE is TRUCK he will execute INSERT/UPDATE/DELETE on TRUCK_TABLE.
    I am using SQL Server 2005.
    Is there any idea how can I solve this problem.
    Thanks in advance
    David
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Originally posted by davidbronsky
    I have question about TRIGGERS.
    I have (4 example) VEHICLE_TABLE with VEHICLE_TYPE column and CAR_TABLE and TRUCK_TABLE also.
    I need TRIGGER for INSERT/UPDATE/DELETE who well read value of VEHICLE_TYPE column in VEHICLE_TABLE and if value of VEHICLE_TYPE is CAR he will execute
    INSERT/UPDATE/DELETE on CAR_TABLE and if value of VEHICLE_TYPE column in VEHICLE_TABLE is TRUCK he will execute INSERT/UPDATE/DELETE on TRUCK_TABLE.
    I am using SQL Server 2005.
    Is there any idea how can I solve this problem.
    Thanks in advance
    David
    triggers are basically stored proc/function/scripts that automatically runs/fires based on event. if you want something done on the CAR_TABLE if a record is inserted/updated/deleted in VEHICLE_TABLE with VEHICLE_TYPE = 'CAR' then just write the trigger in VEHICLE_TABLE, accessing/writing the CAR_TABLE. the same is also true in TRUCK_TABLE.

    if you still need help, kindly post what you want to happen to other tables when the trigger fires, we'll go from there...

    -- ck

    Comment

    Working...