• Hi hunterwoord,

    Are you sure thats the way SQLServer works.?

    Cause i was thinking that when one was testing with IF EXISTS this would just be a logical question and that Sqlsvr would be smart enough to stop looking for more records once he had found one hence he knows the answer and the logical question could already be answered.

    Please confirmation from an expert on this, would be really appreciated

    .

    Cause if this is true i have a lot of sql procedures to reconsider.

    On the other hand i have statements including this logical question

    like :

    Select x, y, z= case when exists( select Key from table where a=b) then 'true' else 'false' end

    from table1 where ...

    And this logical question referencing a 100k+ table without any penalty, runs in 0.003 seconds

    I will on the other hand always make sure that for the IF EXISTS i always select 1 field only and mostly this would be the primary key (indexed)

    What i on the other hand always do is using SELECT TOP 1 when i want to fill up a variable

    Select TOP 1 @MyVar=Field1 from table where..

    for witch i know it could be dangerous without the use of select top1

    Wkr,

    Eddy