I have a database project with SSDT (SQL Server Data Tools) in Visual Studio 2015 and TFS source control.
This morning while I was trying to compare two databases (DB -> TFS), it didn't work and I got an error:
Comparison completed. Difference detected. Restricted comparison. See error list for detail
And in error list window warning was:
Severity Code Description Project File Line Suppression State Warning The login for the target does not have the VIEW ANY DEFINITION permission. The comparison will be restricted to database scoped elements if the source is a database.
SQL Server user for SSDT was sa
.
Thanks in advance
UPDATE: I fixed comparison warning by following query but main problem is exist yet:
USE [master]
GO
Grant VIEW ANY DEFINITION to [USERNAME];
GO
USE [DBNAME]
GO
GRANT CONNECT to [USERNAME]
GRANT VIEW DEFINITION TO [USERNAME]