Question

I'm setting up a new SQL Server Database Project for the first time using an existing database. I created my new project, then imported the database and it worked just fine.

However when I add a new stored procedures to my new Database Project and then do a Compare Schema to my local database, the Add of the new stored procedure doesn't show up.

To be clear, when running the Compare I'm setting my source to my Database Project and target to my local database.

The Compare Schema works great for modifications or deletions of stored procedure scripts in my Database Project just not when I define a new one. Am I missing something? Why don't new stored procedures define in my project show up in the comparison results?

I'm using VS2013, SQL Server 2008 R2.

Was it helpful?

Solution

It turns out when I created the stored procedure in Visual Studio I chose the Script... option instead of the Stored Procedure... option. The image below shows what I should have done.

Add Stored Procedure

Add the file as a Script resulted in the .sql file being added to a different ItemGroup in the project with no build properties. This is what caused the comparison to not pick it up as a stored procedure.

I determined this by looking at the properties of the .sql file (in Visual Studio) that I added and another .sql in the same project where the comparison worked. The file I added as a Script file had different properties than other files that were being treated as real stored procedures.

Moral of the story... make sure you add stored procedures in Visual Studio correctly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top