Minimum database permissions for SQL Data Compare
Published 13 December 2022
SQL Data Compare can compare and deploy data in tables and views of a SQL Server database. In order to do this effectively, the user connecting to the database needs access to the schema (data definitions) and the data objects of a database, and may require additional privileges if the data is being deployed with or without the use of some of the options available for controlling the deployment behavior.
In SQL Server 2000, it is only necessary to be a member of the PUBLIC role in order to gather information about the database schema. To compare data, SELECT permissions are required on all objects whose data is being compared. The easiest way to grant SELECT permissions on all objects is to add the SQL Data Compare user to the database's db_datareader built-in role. To update the database being compared, it is necessary to have INSERT and UPDATE rights granted in addition to SELECT. The easiest way to grant these permissions for all objects in the database is to add the user to the db_datawriter user role.
There is one special circumstance that requires elevated privileges, and that is when the 'disable foreign keys', 'Drop primary keys, indexes, and unique constraints', 'Disable DML triggers', 'Disable DDL triggers', or 'Reseed identity columns' options are used. These actions require access Data Definition Language modification, so it may be necessary to add the user to the db_ddladmin role or DBO role to allow the deployment to succeed if any of the specified options are configured.
The ability to view schema may also be restricted for any users with PUBLIC role membership if the VIEW DEFINITION right has been revoked. One must have VIEW DEFINITION permission granted in order to see the definition of objects in the database.