Monday, March 26, 2012

Relational Data and RDA

I have a few questions for you guys. I have a client

application that can be offline or online. While offline, records can be added and need to be later synced to production.

I will use rda to pull the table down, and this is working fine. Now what if I

have multiple tables where I want a foreign key relationship?

With rda I can only pull down one table at a time from

everything I've read. Now say create a constraint after pulling the two or more tables down. While in offline mode I create a new record on two seperate tables with foreign key/primary key relationship.

When I do the push to the server will it automatically

update the foreign key reference (locally) to the right one on the production

server? Or will I get a duplicate primary key error? On the production server the primary key will be different because of the identity. This is very important because I will have multiple clients.

Thanks in advance

Yes, you can add a foreign key constraint to a pulled table with tracking turned on and when you push it back to the server the key will be created there as well. This is one of the few schema changes that you can propagate back to the server.

When pushing your updates back to the server, no, the push does not also updated foreign key tables. This means if you have table A and table B and B contains a column that is an FK to a column in Table A, you need to always push A then B when doing your RDA push back to the server to prevent an referential integrity issue.

In anything more complex than this in terms of constraints or change tracking, you'll need to consider using merge replication.

Darren

No comments:

Post a Comment