5

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

ScreenShot


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]
Imran Sh
  • 1,623
  • 4
  • 27
  • 50

2 Answers2

1

I had a similar problem. Though you don't have string literals, it might still be working checking:

  • What Schema Compare thinks the difference is - click the expand button to the left of 'Procedure'.
  • If you have 'Ignore whitespace' turned on in the comparison options.
  • If the line ending of your file are windows (CR LF) or unix (LF).
  • (Brute force solution) Use sqlpackage.exe to extract the .dacpac of both databases, rename as .zip, and compare the contents of the two model.xml's - there will be a difference in there somewhere.
Community
  • 1
  • 1
Taran
  • 12,822
  • 3
  • 43
  • 47
0

Finally I solved this problem by drop and recreate object in MSSQLServer:

Imran Sh
  • 1,623
  • 4
  • 27
  • 50