How to Suppress Warning Message "join order has been enforced because a local join hint is used"

  • We have stored procedures run by SQL Jobs in which there are queries that use inner loop joins.

    These inner loop joins are causing warning messages:

    "Warning: The join order has been enforced because a local join hint is used. [SQLSTATE 01000] (Message 8625)"

    that get passed up to the sql job and register with the DBAs as a failure of the job.

    Assuming that we have to keep the inner loop join, is there a way to suppress these messages within the stored procedure or prevent them from being generated in the first place?

    I thought of A try catch block, but this will only capture errors.

    Also, adding the "option (force order)" to the query will quell the warning message, but then the join order of the tables in the query will be hardened.

    Thanks in advance.

  • You could try adding SET ANSI_WARNINGS OFF to your procedure.

    I know this will supress the "Null value has been eliminated by an aggregate function..." messages. I assume it would work for the message you are receiving as well as it is a warning.

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

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