Are boolean expressions in SQL WHERE clauses short-circuit evaluated ?
For example:
SELECT * FROM Table t WHERE @key IS NULL OR (@key IS NOT NULL
This takes an extra 4 seconds in query analyzer, so from what I can see IF is not even shorted...
SET @ADate = NULL IF (@ADate IS NOT NULL) BEGIN INSERT INTO #ABla VALUES (1) (SELECT bla from a huge view) END
It would be nice to have a guaranteed way!