none
VS 2012 database project schema compare error

    Question

  • I have a user who can successfully run a schema compare between SQL database (source) and database project source control (target) in a database project in VS 2012.  When the user tries to migrate the changes, there are two warnings and the migration fails.

    The first error states 'the login for the source does not have the VIEW ANY DEFINITION permission.  The comparison will be restricted to database scoped elements if the target is a database'.

    The second error states 'target update could not update script for element 'dbo''.

    The user is in an active directory group with db_owner and view definition permissions on the source database.  Another developer in the same active directory group with the same permissions is able to successfully migrate the database source to the project destination.

    Any assistance is greatly appreciated.

    Tuesday, May 31, 2016 7:20 PM

Answers

  • Hi bukkybu,

    Since the user belongs to an active directory group and there has other users that have view definition permission to the source database, I'm afraid that this specific user doesn't inherit the View Definition permission from the active directory group.

    Please try set up a login for this user in SQL Server database and then assign the View Definition permission for this user directly to check whether this problem can be resolved or not. If assign the permission directly, which means this user is not inherit the View Definition permission from the active directory group.

    And you are migrating the changes from source database to your database project, is it right? Please try run your Visual Studio as administrator to make sure your database project has enough permission to do any operations.

    Best Regards,
    Weiwei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, June 02, 2016 2:38 AM
    Moderator

All replies

  • Hi bukkybu,

    According to the error message, the problem should be related to the VIEW DEFINITION permission for your current account. Please change another account to confirm whether this problem caused by the accout permission.

    Please take a look at this MSDN article for further information about VIEW DEFINITION Permission: http://msdn.microsoft.com/en-us/library/ms175808(SQL.105).aspx

    In addition, please check the restricted permission of user account you are using. So please double check it with the following script. Please replace the 'UserNameOrLoginName' to the name of the user account you are using.

    select p.name, perm.*
    from sys.database_permissions perm
    join sys.database_principals p
    on p.principal_id = perm.grantee_principal_id
    
    where p.name='UserNameOrLoginName'
    and
    perm.permission_name = 'VIEW DEFINITION'

    Best Regards,
    Weiwei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, June 01, 2016 7:40 AM
    Moderator
  • The user belongs to an active directory group which does have view definition permission to the source database. Another user in the same active directory group does not have the issue.
    Wednesday, June 01, 2016 7:11 PM
  • Hi bukkybu,

    Since the user belongs to an active directory group and there has other users that have view definition permission to the source database, I'm afraid that this specific user doesn't inherit the View Definition permission from the active directory group.

    Please try set up a login for this user in SQL Server database and then assign the View Definition permission for this user directly to check whether this problem can be resolved or not. If assign the permission directly, which means this user is not inherit the View Definition permission from the active directory group.

    And you are migrating the changes from source database to your database project, is it right? Please try run your Visual Studio as administrator to make sure your database project has enough permission to do any operations.

    Best Regards,
    Weiwei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, June 02, 2016 2:38 AM
    Moderator