<p>I am using SQL Server 2000 and I have two databases that both replicate (transactional push subscription) to a single database.  I need to know which database the records came from.</p>

<p>So I want to add a fixed column specified in the publication to my table so I can tell which database the row originated from.</p>

<p>How do I go about doing this?</p>

<p>I would like to avoid altering the main databases mostly due to the fact there are many tables I would need to do this to.  I was hoping for some built in feature of replication that would do this for me some where.  Other than that I would go with the view idea.</p>

[{'answer_id': 64753, 'author': 'Sunny Milenov', 'author_id': 8220, 'author_profile': 'https://Stackoverflow.com/users/8220', 'pm_score': 0, 'selected': False, 'text': '<p>You can create a view, which adds the "constant" column, and use it as a replication source.</p>\n'}, {'answer_id': 65508, 'author': 'Chris Shaffer', 'author_id': 6744, 'author_profile': 'https://Stackoverflow.com/users/6744', 'pm_score': 1, 'selected': False, 'text': '<p>You could use a calculated column Use the following on the two databases:</p>\n\n<pre><code>\nALTER TABLE TableName ADD\n    MyColumn AS \'Server1\'\n</code></pre>\n\n<p>Then just define the single "master" database to use a VARCHAR column (or whatever you want) that you fill using the calculated columns value.</p>\n'}, {'answer_id': 82092, 'author': 'John Hunter', 'author_id': 2253, 'author_profile': 'https://Stackoverflow.com/users/2253', 'pm_score': 1, 'selected': True, 'text': "<p>So the solution for me was to set up the replication publications to allow transformations and create a DTS package for each site that appends the siteid into the tables to keep the ids unique as I can't use guids.</p>\n"}]
['https://Stackoverflow.com/questions/64202', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2253/']