I have a a need to capture some data from one table into the table the receord gets inserted into. Let me explain
I have a SHIPPING_CONTAINER table which has a CONTAINER_ID field and A USER_DEF1 field. The container table also has a numeric status.
Now I also have a table TRUCK which holds truck data one piece is EMPTY_TRUCK_WEIGHT and TRUCK_NUM.
The 2 table match on TRUCK_NUM = SHIPPING_CONTAINER
When the Shipping Container status = 700 I want to grab the EMPTY_TRUCK_WEIGHT from the Truck table and insert it into the Shipping Container USER_DEF1 field
Here is what I have but does not seem to be working
Any help on this is appreciated as I'm very new to triggers
Thanks
RJL
I have a SHIPPING_CONTAINER table which has a CONTAINER_ID field and A USER_DEF1 field. The container table also has a numeric status.
Now I also have a table TRUCK which holds truck data one piece is EMPTY_TRUCK_WEIGHT and TRUCK_NUM.
The 2 table match on TRUCK_NUM = SHIPPING_CONTAINER
When the Shipping Container status = 700 I want to grab the EMPTY_TRUCK_WEIGHT from the Truck table and insert it into the Shipping Container USER_DEF1 field
Here is what I have but does not seem to be working
Code:
UPDATE SHIPPING_CONTAINER SET
SHIPPING_CONTAINER.USER_DEF1 =
(SELECT T.EMPTY_WEIGHT FROM TRUCK T
WHERE I.CONTAINER_ID = T.TRUCK_NUM)
FROM INSERTED I
SHIPPING_CONTAINER.STATUS = 700
Any help on this is appreciated as I'm very new to triggers
Thanks
RJL