cormacio100
cormacio100

Reputation: 67

SQL Server Schema Compare displays all Tables, Views, Procedures, Functions in database

I have a .NET project. When I do a SQL Server Schema Compare between what is on a local SQL Server 2017 database to Visual Studio in the direction of Database --> Project, the compare lists all tables, views, procedures and functions that are in the database under "Add".

It is unable to see the database objects in the project, so it thinks it needs to add everything to the project. Nothing shows in the Target object definition panel for any of the listed objects

If I do go ahead with the update to add a table to the project, E.G. Exhibit table, then it appears as Exhibit_1.sql in the project alongside the existing Exhibit.sql.

However, some changes were made to procedures in the database that showed up under "Change" so I was able to update them as normal

If I reverse the direction of the compare to Project --> Database, it lists all of the objects under Delete

  1. Local Database is SQL Server 2017 but was upgraded from 2008.
  2. Compatibility level is set to 2017 in the database properties in SQL Server Management Studio
  3. In Visual Studio I have set the Target Platform of the database to SQL Server 2017.
  4. I have ticked "Validate casing on identifiers" and Database collation is SQL_Latin_General_CP1_CI_AS on both
  5. Visual Studio is version v15.7.1 and .NET is 4.7.03056

Is there anything else I need to do for the SQL Server Schema Compare to show the correct comparison? Something in the comparison settings?

enter image description here

Upvotes: 1

Views: 413

Answers (1)

Sam_I_Am
Sam_I_Am

Reputation: 1

Check the object's properties in the solution explorer. Verify that the "Build Action" property is set to "Build" and not "None" before performing the schema compare.

Upvotes: 0

Related Questions