• Hugo Kornelis (1/27/2010)


    <snip>

    Other, minor issues are the unneeded brackets around [name] (name is not on the list of reserved keywords, so no delimitation required); the strangely popular but really rather odd EXISTS 1 instead of EXISTS * (EXISTS checks for rows, not values, so what you put there is immaterial - except that * is the standard thhat anyone understands immediately while EXISTS(SELECT 1 makes everybody pause to think); and the broken link in the explanation (the two links both point to the same page).

    Bottom line - the only truly correct answer is "it depends". Of the options give, "both are equal" is almost correct. The other two options are plain nonsense.

    I actually got into the habit of using ...EXISTS(SELECT 1...) because if you use the construct in an object that will be schema-bound, the "*" isn't allowed (even though it's only used for the EXISTS predicate). Seems an oversight on MS's part (or the SQL standard's).

    TroyK