Replicating table with additional info not in table

  • I have one central DB that I want to store the combination of two locations. the table at the central db as an additional field called Location that I want to populate during replication based on the location the data is being replicated from.

    for example...

    when data replicates from location 1 to central i want to populate the location field at central with the value 'loc1'.

    when coming from location 2 i would use the value 'loc2'.

    so the end result would be 1 central table that is a combination of the to locations with the additional location field, letting me know where the information came from.

    Is there any way to do this using replication? What I am trying to avoid is have 2 tables at the central database.

    thanks for your help!

    FYI i'm using SQL Server 2005.

  • If I understand correctly your requirement is to consolidate at the publisher in one central table data from more subscribers, with the evidence of the Location where the row was inserted,

    The solution is very simple and is not really related to replication.

    You need to change the schema of the required table, manually or by script at the publisher and at every subscriber with the following:

    1. Add column "Location", data Type Varchar(?) , ( I would recommend "Tinyint" or "Int" it depends on the total number of subscribers + 1 publisher)

    2. Create a DEFAULT definition (constraint) on the column "Location" by specifying a constant expression which represents the identification of your source, inclusive at the publisher.

    3. Configure your replication.

    That's all,

    I hope it helps.

    By.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply