0

I have three tables in SQL Server 2008

  • Account
  • Case
  • CaseStatus

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

2 Answers 2

1

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)

Sign up to request clarification or add additional context in comments.

Comments

0

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)"

3 Comments

Hear I give only Account Id then depending on Account Id I have to retrieve data from all the three tables . Please help me
@Shankar: You already left a comment, why do you need to edit and paste your comment there?
@Shankar - StephaneT's post should do the trick. you have to change the FilterClause for CaseStatus to query from the_tracking table though as the inner query will not pick up Delete's e.g : CaseStatus table: side.CaseId in (Select CaseId from Case_tracking Where AccountId = @AccountId)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.