• ricardo_chicas (6/4/2013)


    All

    Thanks but you are missing the point. The original query was something much bigger

    I used a top 1 just to show you that there is something wrong with one of the tables

    Even a select field2 from temptable

    Never ends, it is a really small table,

    The engine just can't resolve it, surely a bug or something

    I am just asking what can it be?

    Post the estimated plan for the original query, it's the first (and best) point of call for this type of problem. Without it, folks can only guess.

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden