none
Cannot update identity column 'scope_local_id RRS feed

  • Question

  • I am trying to Sync btw 2 SQL Server 2008 R2 Express. It works if i add sync for the first time using SqlSyncScopeProvisioning.

    now, i remove the scope using SqlSyncScopeDeprovisioning and it removes all the tracking tables and stored procedures.. but leaves 3 tables schema_info,scope_config and scope_info tables which is ok but when i try to create a new scope on the same database i  get the error "Cannot update identity column 'scope_local_id" when i tried to do the SqlSyncScopeProvisioning.Appy(); and i manually delete those tables and it works fine.

    I am using Sync Framework 2.1 with a C# application. 

    I would like to know is this a known bug or am I doing something wrong.

     

    Thanks 

     

     

     

     

    Wednesday, November 17, 2010 2:21 PM

Answers

  • just did a quick test provisioning/deprovisioning two scopes and never got the error and am running SQL 2008 R2 as well.  are you deprovisioning a scope or a template?

    are you cleaning up all scopes? have you tried DeprovisionStore instead?

    • Marked as answer by akakak Wednesday, November 17, 2010 3:08 PM
    Wednesday, November 17, 2010 2:43 PM
    Moderator

All replies

  • just did a quick test provisioning/deprovisioning two scopes and never got the error and am running SQL 2008 R2 as well.  are you deprovisioning a scope or a template?

    are you cleaning up all scopes? have you tried DeprovisionStore instead?

    • Marked as answer by akakak Wednesday, November 17, 2010 3:08 PM
    Wednesday, November 17, 2010 2:43 PM
    Moderator
  • this is what i do

            public bool RemoveScope(string scope,SqlSyncProvider provider)

            {

                try

                {

                    // Remove the scope from the database

                    SqlSyncScopeDeprovisioning scopeDeprovisioning = new SqlSyncScopeDeprovisioning((SqlConnection)provider.Connection);

                    // Remove the scope.

                    scopeDeprovisioning.DeprovisionScope(scope);

                    return true;

                }

                catch (Exception)

                {

     

                    return false;

                }

            }

    Wednesday, November 17, 2010 3:04 PM
  • Thanks,

    scopeDeprovisioning.DeprovisionStore();

     

    Works great.

    Wednesday, November 17, 2010 3:09 PM
  • do you have other scopes in the database? when you deprovision, does the schema_info,scope_config and scope_info tables contain anything?

    if you dont have any other scopes, just try usiing DeprovisionStore instead to remove all sync related objects.

    Wednesday, November 17, 2010 3:13 PM
    Moderator