Hi,
is there some common instructions which WHERE clauses are sargable and which
of them are not?
thnks SinclairSARG is when you have:
colname <op> constant|variable|parameter
<op> includes: <, >, =, <=, >=, <>
Or something that will be converted to above, where
BETWEEN will be converted to:
col <= val AND col >= val
IN will be converted to
col = val1 OR col = val2
col LIKE 'A%' will be converted to
col >= 'A' AND col < 'B'
Things that are not SARG:
col * 25 = 12
SUBSTRING(col, 1, 4) = 'John'
col1 = col2
I.e., never do a calculation on the column side if you can avoid it.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Sinclair" <Sinclair@.discussions.microsoft.com> wrote in message
news:0D58C119-1984-4EAE-90BD-A4043567BC50@.microsoft.com...
> Hi,
> is there some common instructions which WHERE clauses are sargable and whi
ch
> of them are not?
> thnks Sinclair
>
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment