jenlion
IS-IT--Management
- Nov 13, 2001
- 215
Trying to understand the behavior of between here.
I thought that the wildcard % meant 0 or more characters, but I'm running into something I don't quite understand.
This returns no rows.
Change it to
and you get a result.
But I want 'a' to get a result.
Somebody explain the technical reason this doesn't work?
I thought that the wildcard % meant 0 or more characters, but I'm running into something I don't quite understand.
Code:
create table #table1 (nothing int)
insert into #table1 values (1)
select * from #table1 where 'a' between 'a%' and 'b%'
This returns no rows.
Change it to
Code:
select * from #table1 where 'a%' between 'a%' and 'b%'
But I want 'a' to get a result.
Somebody explain the technical reason this doesn't work?