• antonio.collins (1/23/2008)


    nugroho (1/22/2008)


    Hi all,

    Second Question:

    SELECT * FROM Table1 WHERE (@S=1 AND CONTAINS(column1,'key1')) OR (@S=2 AND CONTAINS(column2,'key1')) OR (@S=3 AND CONTAINS(column3,'key1'))

    Does SQL engine will search (CONTAINS) only in 1 column depending on the value of @s-2 ? Or it will search on on all columns, then coming back to see the boolean of the clauses ?

    that should work well since the comparison to @s-2 should be resolved without even considering any rows. so only the desired full text search should take run.

    In T-SQL there is no guarantee about the order of how OR and AND statements are evaluated. Of course precedence rules are observed, and the result will also stay correct, but the optimizer may change the order arbitrarily when it is allowed.

    Regards,

    Andras


    Andras Belokosztolszki, MCPD, PhD
    GoldenGate Software