Charles Bretana
Charles Bretana

Reputation: 146499

Does adding minus sign make query argument un-SARG-able?

Does adding a minus sign in front of a column reference in a SQL statement prevent the query processor from using an existing index on that column to process the query?

i.e., would the following use an index on id if one existed, or would it need to perform a table scan?

Select * from myTable
where -id > 23

vs

Select * from myTable
where id < -23

which is definitely SARGable

Upvotes: 1

Views: 57

Answers (0)

Related Questions