sqlvisual-studio-2010database-projectvisual-studio-dbpro

Visual Studio DB project fails to detect changes to stored procedure parameters. Is that normal?


Whilst working on a SQL Server 2008 database project in Visual Studio 2010 I added a new parameter to an existing stored procedure definition. When I built the project it failed to detect that references to the sproc elsewhere in the project did not have enough parameters. It even let me deploy the project.

Is this the way it's meant to behave or have I forgotten to tick a box somewhere?!

Sam : )


Solution

  • Database projects do not detect problems with procedure/function parameters. Also, you will notice you can delete the offending procedure/function from your project all together and it won't fail.

    In my case, I use an external tool for managing programmability, so not failing the build because of missing procs is a plus.

    If you want to validate your procedures and functions you can write a scipt that will execute all your stored procedures with using "SET FMTONLY ON". The procedure will be compiled, but no permanent changes will be made to the DB during execution. You can't use this with procedures that use temporary tables (#table syntax).

    That's how Microsoft does it in Visual Studio to determine what the output of your stored procedure should be.