Asked By Aaron Bertrand [SQL Server MVP]
10-Apr-08 06:27 PM
Because Da comes AFTER D alphabetically. If you ordered by client name,
would you expect this order:
B
Batilla
Charlestown
D
Dalhousie
Or this order:
B
Batilla
Charlestown
Dalhousie
D
Since between logically stops at 'D', the latter must be what you expect if
you think 'Dalhousie' should be between B and D.
Maybe you meant:
LEFT(ClientName, 1) BETWEEN 'B' and 'D'
?
Same,
LEFT(CLientName, 1) BETWEEN 'V' AND 'Z'
If there is an index on ClientName, this may be more efficient:
ClientName LIKE '[B-D]%'
ClientName LIKE '[V-Z]%'
A