• Lowell (7/24/2013)


    pwalter83 (7/24/2013)


    Thanks Lowell,

    However, I was wondering is it not possible to implement this logic within the table structure because as I mentioned earlier, the values in one table would be updated through a webpage. The changed value then needs to be reflected in the other related table.

    Would it be possible to achieve this by developing a primary key-foreign key relationship and then use trigger to update the values in the other table ?

    Thanks.

    Walter, yes it's possible using a trigger and a relationship between the two tables(ie a PK/FK), and i certainly understand that sometimes it's going to be done regardless of whether its following best practices and just doing the work to get the job done;

    I just wanted to provide a decent discussion on all possible aspects i could think of;

    if you have the DDL for the two tables, and the column(s) you want copied, we could help with the trigger;

    but of course,here's my follow up question:

    if you insert into Table1, do you know for sure rows exist in Table2, or do you have to create those rows int eh trigger as well? is this only for updting, so you know both rows already exist due to some other process having created them previously?

    Thanks for your suggestion and sorry for the late reply.

    This is only for updating the values when they change in the first table.

    Is it possible to give an example on how to accomplish this or perhaps you can guide me into what to search for in google to achieve this scenario ?

    Thanks again !