Re: Using SELECT with EXISTS

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Zach Wells (no_zwells_spam_at_ain1.com)
Date: 04/30/04


Date: Fri, 30 Apr 2004 11:45:01 -0400

Anon wrote:

> I used to use
>
> IF NOT EXISTS ( SELECT 1 FROM Table WHERE col = 'x' ) BEGIN
> ....
> END
>
> I read in Ken Henderson's book that you should use SELECT * with EXISTS because the query optimizer will coose an effeciant plan for you. After years of SELECT 1 I'm thinking I should start using SELECT * with EXISTS. What is the recommended way thses days?
>
> Thanks in advance.
>

I don't think it really matters, but using * is a bit more standard I'd
guess.

Zach