I have a table of employees and a program that displays some query criteria that the user can use for the SELECT
, for example, an user can search for an employee (or a set of them) by using the employee ID, however, I let the user select a range of IDs to make the search.
In this implementation the DB holds string values for the ID, they look like this:
'000001','000002'....,'000200' and so on, whilst being strings they are also numbers. So when I make a query like this:
select * from employees where id_employee BETWEEN '000001' AND '000056'
I get the results I would expect, but when I do this:
select * from empleados where id_empleado BETWEEN '000056' AND '000001'
I get nothing, it would seem as if SQLServer is treating the valus as Integers or Decimal values and thus not being able to get the results.
I could make a validation in the criteria window I use, but I was wondering if there was a way to make it default for the DB or anything that would avoid me having to change about 100 of this criteria windows.
Thanks in advance.
EDIT: I am not arguing the functionality of the BETWEEN operator, but rather looking for a way to still use it by telling SQLServer to do it the way I should be using it??