Alter Procedure With Invalid Object Name

  • We are trying to update a stored procedure to reference objects that don't yet exist in preparation for when they will exist. The problem is SSMS doesn't like that and gives the error that there are invalid objects. Is there a way to trick it into allowing the invalid references?

  • Create synonyms for the missing objects, SQL Server doesn't check if the object really exists or not.  You can then create a proc that references the synonym.  When you are ready, drop the synonym and create the real object with the same name.

    create synonym TheObject for AnyNameHere

    create procedure test
    as
    begin
    select * from TheObject
    end

     

    • This reply was modified 3 years, 1 month ago by  DNA_DBA.
  • This was removed by the editor as SPAM

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply