views:

45

answers:

2

I have tons of stored procedures in my database. We are constantly changing the data structure (we are in development) Is there a tool that will tell me which stored procedures won't compile?

When you create a stored procedure it prevents you if there is an invalid table or column, but if you change the column name after the stored procedure is created, your proc is invalid. I'd like to get a list of those invalid procs.

cheers!

Joseph

+1  A: 

Your best bet is to write some database unit tests, if you are using VS2008 then it is pretty simple to do, but time-consuming.

But, then you can run your tests and ensure that everything is either working as you expect, or get a list of functions you need to look at.

You may find this article on database unit testing to be interesting, but I do believe it may require VS Team System.:

http://www.developer.com/db/article.php/3758601/Introducing-Visual-Studio-Team-System-2008-Database-Unit-Testing.htm

James Black
Consider a continuous build tool like Cruise Control. Have it run every hour and include the above mentioned automated tests. This way, if something changes, you're only an hour behind at worst.
Sonny Boy
@Sonny Boy - The only difficulty I encounter is how to keep the database in-sync for tests like this, as you have to keep the cruise control database and your own development database in-sync. I haven't found an easy way to upload my database project and have TFS do the synchronization automatically.
James Black
+2  A: 

You can use this tool put together at CodeProject which uses built-in SQL functions and options to generate a text file of invalid stored procedures.

http://www.codeproject.com/KB/database/validatingsql.aspx

CodeByMoonlight