[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1474
  • Last Modified:

Microsoft Sync Framework Filtering and Multiple Tables

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
rcblevins
Asked:
rcblevins
  • 4
  • 4
1 Solution
 
Matt BowlerDB team leadCommented:
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
 
rcblevinsAuthor Commented:
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
 
Matt BowlerDB team leadCommented:
Can you clarify what you mean by scope?
0
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!

 
rcblevinsAuthor Commented:
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
 
Matt BowlerDB team leadCommented:
Okay - definitely use views :)
0
 
rcblevinsAuthor Commented:
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
 
Matt BowlerDB team leadCommented:
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
 
rcblevinsAuthor Commented:
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!

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now