I have a sql database that have InvoiceNumber column
Now i need to select range between two numbers, but i don't know what happened.
I've tried "Between" and "<= , >=" Statements but the results are same.
For example: If i need range between "13000" and "13020" and there is number "1301" its appear in results.
CodePudding user response:
You will need to conver your value in the where clause to do this.
CodePudding user response:
I think that is becouse your InvoiceNumber is a varchar. As @Nathan_Sav mentioned, you need to convert it to something comparable, for example bigint.
select * from SalesInvoice where convert(bigint, InvoiceNumber) >= 13000 and convert(bigint, InvoiceNumber) <= 13020 and Status = 'True'
