Finding Compiled Object Errors Before Production

Changes made in earlier versions of Adaptive Server may cause compiled objects to work differently in version 12.5.x and later.

Use dbcc upgrade_object to find the following errors and potential problem areas that may require manual changes to achieve the correct behavior:
  • Missing, truncated, or corrupted source text

  • Temporary table references

  • Reserved word errors

  • Quoted identifier errors

  • select * potential problem areas

After reviewing the errors and potential problem areas, and fixing those that need to be changed, you can use dbcc upgrade_object to upgrade compiled objects manually instead of waiting for the server to upgrade the objects automatically. For details, see Using dbcc upgrade_object.

Compiled Object problem Description Solution
Missing, Truncated, or Corrupted Source Text If the source text in syscomments was deleted, truncated, or otherwise corrupted, dbcc upgrade_object may report syntax errors.
  • If the source text was not hidden, use sp_helptext to verify the completeness of the source text.
  • If truncation or other corruption has occurred, drop and re-create the compiled object.
Temporary Table References If a compiled object such as a stored procedure or trigger refers to a temporary table (#temp table_name) that was created outside the body of the object, the upgrade fails, and dbcc upgrade_object returns an error. To correct this error, create the temporary table exactly as expected by the compiled object, then execute dbcc upgrade_object again. You must not do this if the compiled object is upgraded automatically when it is invoked.
Reserved Word Errors For example, suppose you load a database dump from Adaptive Server 11.5 into Adaptive Server 15.0 and the dump contains a stored procedure that uses the word “lock.” When you run dbcc upgrade_object on that stored procedure, the command returns an error because, although “lock” was not reserved in version 11.5, it became a reserved word in version 11.9.2. With this advance notice, you can change the stored procedure and any related tables before they are used in a production environment. Either manually change the object name or use quotes around the object name, and issue the command set quoted identifiers on. Then drop and re-create the compiled object.