sanjays-735734 (6/7/2010)
Hi DavidI would like to add something in Your "simple example"...
IF EXISTS(SELECT 1 FROM ... WHERE...)
Instead of this Use following...
IF EXISTS(SELECT TOP(1) 1 FROM ... WHERE...)
Sanjays, I've found that the IF EXISTS in nearly all cases generates the same execution plan.
You can get away with SELECT * however I've always hammered in the disciplines of not using SELECT * so I don't confuse developers with the cases where it doesn't matter.