Re: Rewrite a WHERE clause
- From: "--CELKO--" <jcelko212@xxxxxxxxxxxxx>
- Date: 29 Aug 2005 12:34:38 -0700
SQL programmers tend to trust the optimizer rather than write programs
that change on the fly. We also like the easiest to read form of
identical expressions:
county LIKE COALESCE (@my_county, '%')
Go with this and let the compiler figure out if the parameter is a
NULL, a string or a pattern. The LIKE predicate generates a simple
finite state machine to parse a string using the pattern given. The
state machine for '%' is very fast.
.
- Follow-Ups:
- Re: Rewrite a WHERE clause
- From: Erland Sommarskog
- Re: Rewrite a WHERE clause
- From: AK
- Re: Rewrite a WHERE clause
- References:
- Rewrite a WHERE clause
- From: joshsackett
- Rewrite a WHERE clause
- Prev by Date: Re: Rewrite a WHERE clause
- Next by Date: Can @@ROWCOUNT return NULL?
- Previous by thread: Re: Rewrite a WHERE clause
- Next by thread: Re: Rewrite a WHERE clause
- Index(es):
Relevant Pages
|