Reputation: 89
I have three tables in SQL Server 2008
Table Case
has a reference using column AccountId
to AccountTable
, and CaseStatus
has a reference on caseId
to table Case
.
I need to sync these three table depending on AccountId(AccountTable)
. Please help me to write code (template) in Microsoft Sync Framework
Upvotes: 0
Views: 96
Reputation: 2714
If I understand correctly, you want to use an AccountId selected on the client side to sync data from all three tables to the client, but limited to the AccountId.
Pass along the accountId as a parameter when filtering (see How to: Filter Data for Database Synchronization (SQL Server))
Next, you need to rewrite the filterclause with subselects to something like this, assuming you name your parameter 'AccountId':
Account table: side.AccountId = @AccountId
Case table: side.AccountId = @AccountId
CaseStatus table: side.CaseId in (Select CaseId from Case Where AccountId = @AccountId)
Upvotes: 1
Reputation: 7860
are you filtering on AccountID?
you can set the FilterClause for the Case table to "side.AccountId in (Select AccountId from AccountTable)"
and for CaseStatus table to "side.CaseId in (Select CaseId from Case)"
Upvotes: 0