WITH RECOMPILE for a single statement?

  • I'm testing a query and wish to run this query in SSMS each time as if it were a new query, no queryplan or compiuled version. We have WITH RECOMPILE for SP's, do we have something similar for a single statement?

    TIA

    Greetz,
    Hans Brouwer

  • If you're running against a test server, just clear the proc cache each time before you run it. Otherwise, if you want a recompile for a single query, use OPTION (RECOMPILE) as a query hint.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

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

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