I have a question for the masses.
I won't be able to respond until tomorrow, so that will be why you don't see a response.
I'm pretty sure using the LIKE clause and LEFT statement on chars and varchars are not sargeable. If one of them is, please tell me (I know LIKE isn't).
What would be a faster way to reference a string??
If I have a small string 'rat' and I want to return any values in a char field that have the first 3 letters = 'rat', which is faster??
OR
I'm thinking the 2nd query, but I have no fact to base this upon. Thanks for your input.
![[monkey] [monkey] [monkey]](/data/assets/smilies/monkey.gif)
<.
I won't be able to respond until tomorrow, so that will be why you don't see a response.
I'm pretty sure using the LIKE clause and LEFT statement on chars and varchars are not sargeable. If one of them is, please tell me (I know LIKE isn't).
What would be a faster way to reference a string??
If I have a small string 'rat' and I want to return any values in a char field that have the first 3 letters = 'rat', which is faster??
Code:
Select col from table1 where col like 'rat%'
Code:
Select col from table1 where left(col, 3) = 'rat'
I'm thinking the 2nd query, but I have no fact to base this upon. Thanks for your input.
![[monkey] [monkey] [monkey]](/data/assets/smilies/monkey.gif)
![[snake] [snake] [snake]](/data/assets/smilies/snake.gif)