Column Description
table_name Holds the names of tables for which primary key pools
must be maintained. In our simple example, if new sales
representatives were to be added only at the consolidated
database, only the Customer table needs a primary keypool
andthis column is redundant. Itis included to show a general
solution.
value Holdsa list of primary keyvalues. Each value is unique for
eachtable listed in table_name.
location In some setups, this could be the same as the rep_keyvalue
of the SalesRep table. In other setups, there will be users
otherthan sales representatives and the two identifiers should
bedistinct.
Forperformance reasons, you may wish to create an index on the table:
CREATE INDEX KeyPoolLocation
ON KeyPool (table_name, location, value)
go
Replicating the primary key pool
Youcan either incorporate the key pool into an existing publication, or share
itas a separate publication. In this example, we create a separate publication
forthe primary key pool.
Toreplicate the primary key pool
1. Create a publication for the primary key pool data.
sp_create_publication ’KeyPoolData’
go
sp_add_remote_table ’KeyPool’
go
sp_add_article ’KeyPoolData’, ’KeyPool’,
NULL, ’location’
go
2. Create subscriptions for each remote database to the KeyPoolData
publication.
sp_subscription ’create’,
KeyPoolData,
field_user,
rep1
go
176