Re: Rewrite a WHERE clause
- From: "AK" <AK_TIREDOFSPAM@xxxxxxxxxxx>
- Date: 29 Aug 2005 12:54:04 -0700
I would keep things simple
if @COUNTY is NULL
--------- scan the table
select * from some_table
else
-------- might use an index
select * from some_table where conty = @county
end if
this way you'll have 2 precompiled plans for 2 different cases
.
- References:
- Rewrite a WHERE clause
- From: joshsackett
- Re: Rewrite a WHERE clause
- From: --CELKO--
- Rewrite a WHERE clause
- Prev by Date: Can @@ROWCOUNT return NULL?
- Next by Date: Will SQL 2k 64bit ed dump files load on 32bit SQL2k?
- Previous by thread: Re: Rewrite a WHERE clause
- Next by thread: Re: Rewrite a WHERE clause
- Index(es):