Procedure Creation – Correct Syntax, Wrong Database | John Morehouse
Recently, on a Friday evening, we released an update to one of our core applications. As expected, it went smoothly and no issues were noted. On the following Monday morning, however, the story took a different turn when end users started reporting issues. One of the issues encountered was related to a new stored procedure. In looking at the procedure, we found there were references to a database that existed within the QA environment but did not in Production. It was assumed that when the procedure was created, it would throw an error because the database referenced didn't exist. Unfortunately, it does not work like this. When the procedure is created, only the syntax of the code is parsed for validity. As long as the syntax is correct the procedure will be created without an issue. This can cause an issue because invalid references can slip by. The real issue will manifest when the procedure is actually called. The syntax will be checked again by the Parser and then sent to