I have a SQL Server table with client names. I need to select a range of
names from this list, but the between clause does not work well

Example; select all names begininng with A up to M

sql statement

select name from mydatabase.dbo.customers
where name between 'A%' and 'M%'
order by name

The result is a list of names beginning with A and up to L

To get the names beginning with M I need to write the where clause as
follows

where name between 'A%' and 'N%'

I also tried :

where name >= 'A%' and name <= 'M%'

The resultant list goes from A to L, it does not show the names beginning
with 'M'

What is the solution, please?

BTW, is there a range function in T-SQL, similar to Excel (A:M)?



Rafael Copquin




<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Libre
de virus. www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/CAHM-jJ15fUs9AJo5tsdwvEbMfjnYN2-+F=y12j1jhcu2asy...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to