Re: Sync/Merge local sql compact databases to single global database
- From: "William \(Bill\) Vaughn" <billvaRemoveThis@xxxxxxxxx>
- Date: Sat, 23 Jun 2007 10:27:18 -0700
One approach is to create a unique ID for each device. The PK could then be
constructed from this number (like 22) and a Identity value. When merged
with the host database you have the advantage of a unique number and knowing
from which device it was derived.
hth
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
"Chris" <morleyc@xxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:C9913000-0E41-40DF-8FC8-B81421D49A0D@xxxxxxxxxxxxxxxx
Hi, I have compact sql databases which will be local on multiple users
devices. Due to space constraints, for one of the tables i have had to use
auto incrementing integer which works fine for the local database but i
would like to merge all of the users databases into a global database. The
table format can be seen below:
CREATE TABLE Players
(
ID UNIQUEIDENTIFIER NOT NULL PRIMARY KEY,
FirstName NVARCHAR(32),
LastName NVARCHAR(32)
);
CREATE TABLE Sessions
(
ID INTEGER NOT NULL IDENTITY,
PlayerID UNIQUEIDENTIFIER ,
SessionDateTime DATETIME,
CONSTRAINT pkSessions PRIMARY KEY (ID),
CONSTRAINT fkPlayerID FOREIGN KEY (PlayerID) REFERENCES Players(ID)
);
CREATE TABLE SessionDetail
(
SessionID INTEGER,
Time real,
Power real,
CONSTRAINT pkSessionDetail PRIMARY KEY (SessionID,StrokeTime),
CONSTRAINT fkSessionID FOREIGN KEY (SessionID) REFERENCES Sessions(ID)
);
The Players table will merge fine as GUIDs are used. However, how will the
sync capabilities of compact SQL handle the sessions table? When it pushes
the local data to the remote database will it change the Sessions.ID
column to a unique field (as no doubt lots of people will have 1, 2, 3 in
their local databases and the global database must have a unique ID), and
then transfer this changed ID back to the local database? Furthermore, if
it changes the Sessions.ID column during the merge it will also need to
update the SessionDetail.SessionID foreign key to maintain referential
integrity, is this also handled?
So my question is, how much of this sync and data merge is automated and
are there any good examples or pointers for my scenario? I cannot
reasonably use a GUID for Session.ID as there will be lots of
SessionDetail entries and the size would be far too much.
Many thanks,
Chris
.
- Follow-Ups:
- References:
- Prev by Date: Sync/Merge local sql compact databases to single global database
- Next by Date: Re: Sync/Merge local sql compact databases to single global database
- Previous by thread: Sync/Merge local sql compact databases to single global database
- Next by thread: Re: Sync/Merge local sql compact databases to single global database
- Index(es):
Relevant Pages
|