Re: Questions about RDA & Replication
- From: "Marius Bucur" <marius.bucur@xxxxxxxxxxxxxxxx>
- Date: Tue, 25 Oct 2005 17:23:11 +0300
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
.
- Prev by Date: Re: Can't find PInvoke DLL 'sqlceme30.dll' (VS2005/SQLMobile)
- Next by Date: Re: How to determine GUID of newly-inserted record?
- Previous by thread: SQL Ce Merge Replication question
- Next by thread: Re: How to determine GUID of newly-inserted record?
- Index(es):
Relevant Pages
|