Solved

Microsoft Sync Framework Filtering and Multiple Tables

Posted on 2013-05-25
8
1,262 Views
Last Modified: 2013-06-04
I need to wirte an application to sync data from an SQL Server 2008 and an SQL Server Compact 3.5 database.  The application will be written in VS VB 2008.  I need to use parameterized filtering so only the data the mobile user needs will be synced.  My problem is that I'm having a hard time wrapping my head around how to determine what tables will be added to each scope and how to design the scopes.  What's giving me the most trouble is how to do a paramterized filter for a table that doesn't have the data that will determine what will be filtered.  For example: our customer database is designed only with an identifier that joins it back to an address table for address information and the address table joins back to a zip code table to get the zip code information which contains the city and state, so for me to filter a customer by state I have to join it to 2 other tables.  How do I design the scopes for this situation?  Thanks for any help.
0
Comment
Question by:rcblevins
  • 4
  • 4
8 Comments
 
LVL 9

Expert Comment

by:MattSQL
ID: 39198317
I think that this is just a compromise that you make when you build a highly normalised OLTP system.

I suppose that you always have the option of de-normalising any of the filter fields that are commonly used and potentially giving performance issues due to the joins? Personally I wouldn't the join in your example doesn't sound overly complex or resource intensive.
0
 

Author Comment

by:rcblevins
ID: 39198367
Ok.  Thanks.  Are you saying I need to modify the db to have all of the fields I need to do the scope with in one table? Or is there a way to do the scope by joining the tables needed or is there a way to use a view?  Thanks for your help.
0
 
LVL 9

Expert Comment

by:MattSQL
ID: 39198499
Can you clarify what you mean by scope?
0
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 

Author Comment

by:rcblevins
ID: 39198516
I'm referring to where you define a scope or template that you add tables to for Microsoft Sync Framework.  At least by what I read (I am not completely familiar with it yet) after you have set up the scope or template and provision it using the sync framework you can make it available for syncronization with the client db.  What I need clarification on is when I set up this scope and want to filter it how do I do that when I'll need to do table joins to get the filtering data I need. Thanks for your help.
0
 
LVL 9

Expert Comment

by:MattSQL
ID: 39198523
Okay - definitely use views :)
0
 

Author Comment

by:rcblevins
ID: 39199888
Ok.  Thanks.  I don't see any where it says you can use views with Microsoft Sync Framework.  Can you use views and can you give me an example of how to use it?  Thanks again.
0
 
LVL 9

Accepted Solution

by:
MattSQL earned 500 total points
ID: 39199893
Essentially you can follow the steps outlined here:

http://msdn.microsoft.com/en-us/library/dd918682(SQL.105).aspx

But at step 2 identify the tables to synchronise you use a view that has all the joins that you need. Views are table valued objects so will work the same way as a table in this context.
0
 

Author Comment

by:rcblevins
ID: 39218750
Thanks.  I think that will work.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question