Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

numerical ordering

Status
Not open for further replies.

doddo

Programmer
Feb 14, 2001
37
GB
Hi, I usually use MySQL so haven't come accross this problem before.

I have an integer field, and say I want to pull up all entries with values between 18 and 20, I would normally use:

SELECT * FROM users where ch_4_year>=18 and ch_4_year<=20

MS SQL appears to consider the following to be ascending

1
10
11
12
13
14 etc.

Therefore the above command also pulls out values of
2 as well as 18,19,20.

Does anybody know how to avoid this?

Thanks in advance
Rich
 
you're absolutely right, sorry about that!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top