• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 322
  • Last Modified:

What is the comparison I can use to make the code run its fastest?

In a query I want to examine a string.   I want to learn if the string's first position is "1".
So, I want to say if this string's first character is "1" then do something.

I have used either        iif( Left([thevariable],1) = "1",
and I have used           iif( [thevariable] like "1*",

Which of the two statements run faster OR is there another form my comparison can take?

1 Solution
Kent OlsenData Warehouse Architect / DBACommented:
Hi rgcole,

That would depend entirely on the parser, optimizer, and indexing of the underlying DBMS.  But you'd be hard pressed to find a modern DBMS that didn't handle either one quite well.

For most modern optimizers it shouldn't matter.  The call to LEFT will return a single character that the DBMS will handle just as if LIKE '1%' had been used.

Good Luck,
QlemoC++ DeveloperCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now