Hello everyone,
I'm not a database guru so I'm sorry if this is a dumb question but here it
goes...
I have this sql query that I'm trying to run against a table on a Sql 2k
server:
SELECT *
FROM ChangeTable
WHERE (CompanyName >= 'Ad%') AND (CompanyName <= 'L%')
What I'm trying to do is get a range of data where the CompanyName column
is greater than or equal to and also less than or equal to certain values.
The problem I'm having is with the less than, equal to operator (<=); it
doesn't seem to evaluate to true when the CompanyName column is in an equal
state. For example if I have this data:
rowId CompanyName
1 Advair
2 Abus, Inc.
3 Lohan Bros.
4 Moop, Inc.
Running the query from above I would expect (with my feeble database mind)
to get back two records (rowId 1 and 3) but I currently only getting back
one record (rowId 1).
My question is this. Is the above query even valid in sql? Also can the %
wildcard be used with the <= operator when dealing with varchar columns?
Thank you for any help with this issue.