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开发者_Go百科 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 : )
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.
Unless you re-run the code generation wizard (by deleting the sproc in the VS Server Explorer then dragging it back in) your project doesn't know that the database has changed. You may get runtime errors but not compile errors.
If it doesn't know about any changes it will compile normally. So yes, it's supposed to behave that way.
精彩评论