views:

60

answers:

1

Hi,

Using microsoft sync framework 2,is there a way to sync all tables between two ms sql 2008 databases, with out specifically adding each table to a scope?

Thank you!

+1  A: 

Thants exactly what it does. You will need to run through the wizard to set it up, but for the senario you describe thats quite straightforward heres a link to read more about it. http://msdn.microsoft.com/en-us/sync/bb821992.aspx

You need to add each table into the SyncGroup, theres no way around that, but you could do that programatically.

Find the tables

SELECT * FROM sys.Tables

Then the sync stuff.

Dim customerSyncGroup As New SyncGroup("Customer")
Dim customerSyncTable As New SyncTable("Customer")
customerSyncTable.CreationOption = TableCreationOption.DropExistingOrCreateNewTable
customerSyncTable.SyncDirection = SyncDirection.DownloadOnly
customerSyncTable.SyncGroup = customerSyncGroup
Me.Configuration.SyncTables.Add(customerSyncTable)

Just checking, you are trying to sync from a main server to a client? One is SQL 2008 express, or SQL Ce, or some other client database?

If you are trying to sync between two fully grown sql 2008 servers, then there are better options such as replication, log shipping etc.

JohnnyJP