CREATE or ALTER PROCEDURE not detecting invalid object names.

  • Hello,

    I have an odd problem that is causing me some frustration. When I execute a CREATE PROC or ALTER PROC statement in SQL Management Studio, the query will complete successfully even when the procedure statements reference non-existant objects.

    I am used to the query failing with a error stating that the object does not exist. Is there some database, server or query configuration option that I have forgotten or overlooked?

    The following code demonstrates the issue.

    CREATE PROCEDURE testProc AS SELECT * FROM NonExistentTable

    GO

    When I execute this code, I get the message "Command(s) completed successfully."

    But when I execute the procedure, thus:

    EXEC testProc

    I get the message "Msg 208, Level 16, State 1, Procedure testProc, Line 1

    Invalid object name 'NonExistentTable'."

    Shouldn't the "Invalid bject name" error occur when I execute the CREATE PROCEDURE query??

    Any advice welcome.

  • duplicate post, do not reply to this thread.

    continue the discussion here

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Sorry - Did not see

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

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