Re: Questions about RDA & Replication



Hi,

I suppose that you are referring to sql server ce 2.0

> My question consists of two parts.
>
> 1) When I do RDA, is the relationship preserved? What about Merge
> Replication?


When performing RDA relations are not preserved in the corresponding sql ce
data base, when performing replication relation for a table T are preserved
only when all tables that foreign keys from T refers are also in the
publication. In order to check this behavior inspect the
INFORMATION_SCHEMA.TABLE_CONSTRAINTS view.




> 2) I have a table which contain an ID column. Initially, there are records
> (say 10 records) in the table on the SQL Server side. I performed a PULL
> (or
> replication ) to the SQL CE. And once I insert a record to the table on
> the
> SQL CE, I got an error saying Primary Key violation. Then I realized that
> the
> table's ID Column in SQL CE is starting from 1 (rather than the MAX(ID) +
> 1).
> Is there a way to work arround that?

In order to reseed the identity fields to the maximum existing value plus 1
you can perform a compact repair of the database after the synchronization
has completed but this will cause problems, if you have more subscriber they
will start from the same seed and will generate the same values so there
will be conflicts when you push data back to the server.



One approach is to allocate a distinct range for each subscriber and a range
for the server, you can use

ALTER TABLE [TableName] ALTER COLUMN [IDCol] IDENTITY (subscriberseed, 1)

in subscriber database to generate values from a specific range, however be
careful because you must rerun this command after all repair compact
operations.



You can also use merge replication to avoid these issues (it will maintain a
range for each subscriber), prior of putting tables in merge replications
ensure that identity fields have NOT FOR REPLICATION flag and when configure
replication select automatic identity range management for each table.
However my experience with replication and automatic identity ranges was not
so happy, for me it works on my development machine but in production after
a while systematically some subscribers received previously allocated ranges
so I end up implementing my own identity range management.



Marius




.



Relevant Pages

  • Re: replicated commands not executed on the subscriber side?
    ... My current environment is the most complex sql server environments in my 10+ ... Unlike the replication procedure when changes made at Subscriber, ...
    (microsoft.public.sqlserver.replication)
  • Re: SQLEXPRESS Replication?
    ... The way the Technet SQL BOL is arranged it is difficult to know just how to setup the required permissions to do replication which is the major stumbling block. ... You can replication from SQL Server 2005 Workgroup edition and above ... to a SQL Server Express subscriber using transactional replication. ...
    (microsoft.public.sqlserver.replication)
  • Re: merge Replication with a Notebook not in domain
    ... not associated with a trusted SQL Server connection. ... I have set up all SQL Server login in both publisher and subscriber.Also ... Looking for a SQL Server replication book? ... subscriber ...
    (microsoft.public.sqlserver.replication)
  • Re: SQLEXPRESS Replication?
    ... You can replication from SQL Server 2005 Workgroup edition and above ... to a SQL Server Express subscriber using transactional replication. ... So far the error messages have been very unhelpful. ...
    (microsoft.public.sqlserver.replication)
  • Re: Nonconvergence issue after upgrading MSDE to SQL 2005 Express
    ... Looking for a SQL Server replication book? ... Replication is running as a scheduled task on the subscriber (pull) ... Replication uploads changes to publisher ...
    (microsoft.public.sqlserver.replication)