• ChrisM@Work (7/24/2013)


    pwalter83 (7/24/2013)


    ChrisM@Work (7/24/2013)


    Lowell has already asked but the question remains unanswered: why do you want to hold the same data in two places at once?

    Hi,

    The reason is - The same data needs to exist in two related tables is bacause this is part of the web project consisting of many sub-pages. If the value in one sub-page is changed then that saved value in the main webpage should be updated accordingly.

    Each of these webpages are linked to individual tables so in fact the changes are to be made at the SQL level first.

    Surely the main page and the subpage should be reading the same value from the same table?

    Sorry Chris, you were right about this, could you please help me further ?

    I wish to track the changes in table1 if the row is updated on table2 based on the condition that both tables are linked through primary-foreign key (VENDOR_ID). In other words, if VENDOR_NAME is changed on table2 then that change should be reflected on table1 through VENDOR_ID. Can this be achieved through a trigger ? If yes, then could you please guide me how can that be accomplished.

    The DDL for table 1 and 2 are as below:

    CREATE TABLE [dbo].[table1](

    [SYSTEM_ID] [int] IDENTITY(1,1) NOT NULL,

    [SYSTEM_NAME] [varchar](100) NOT NULL,

    [VENDOR_ID] [varchar](100) NOT NULL

    CREATE TABLE [dbo].[table2](

    [VENDOR_ID] [int] IDENTITY(1,1) NOT NULL,

    [VENDOR_NAME] [varchar](100) NOT NULL

    Thanks in advance for your help.