search
Japanese Chinese Nederlands Espanol Italiano Deutsch Francais Twitter Rss Feeds
SQL Server GroupsView
SQL Server Ce
SQL Server Clients
SQL Server Clustering
SQL Server Connect
SQL Server Dts
SQL Server Fulltext
SQL Server Integrationsvcs
SQL Server Msde
SQL Server Newusers
SQL Server Olap
SQL Server Programming
SQL Server Replication
SQL Server Reportingsvcs
SQL Server Security
SQL Server Server
SQL Server Setup
SQL Server Tools
SQL Server Xml

Group SummariesView
.NET Framework
Access
BizTalk
Certifications
CRM
DDK
Exchange Server
FoxPro
French
French .NET
Games
German
German .NET
Graphic Design
IIS
Internet
ISA Server
Italian
Italian .NET
Maps
MCIS
Miscellaneous
Mobile Application Development
Money
MSN
Networking
Office
Ops Mgr
Publisher
Security
SharePoint
Small Business
Spanish
Spanish .NET
SQL Server
Systems Management Server
Transaction Server
Virtual PC / Virtual Server
Visual Studio
Win32
Windows 2000
Windows 2003 Server
Windows 7
Windows Live
Windows Media
Windows Update
Windows Vista
Windows XP
 

View All Microsoft SQL Server Programming Posts  Ask A New Question 

Hello Aaron,set me right if i'm wrong, as far as i understand you want to - Karim Moussa

Thursday, April 10, 2008 6:25 PM

Hello Aaron,

set me right if i'm wrong, as far as i understand you want to return the
clientName that it's first letter is between range of charecters, If I'm
right then you should use this method:

select clientName from table_Name where clientName like '[A-p]%'

let me know if this is not what you want?


Regards,
Karim Mohamed
reply
 

Because Da comes AFTER D alphabetically. - Aaron Bertrand [SQL Server MVP]

Thursday, April 10, 2008 6:27 PM

Because Da comes AFTER D alphabetically.  If you ordered by client name,
would you expect this order:

B
Batilla
Charlestown
D
Dalhousie

Or this order:

B
Batilla
Charlestown
Dalhousie
D

Since between logically stops at 'D', the latter must be what you expect if
you think 'Dalhousie' should be between B and D.

Maybe you meant:

LEFT(ClientName, 1) BETWEEN 'B' and 'D'

?


Same,

LEFT(CLientName, 1) BETWEEN 'V' AND 'Z'

If there is an index on ClientName, this may be more efficient:

ClientName LIKE '[B-D]%'

ClientName LIKE '[V-Z]%'


A
reply

using between with character values - mohaaro

Friday, April 11, 2008 2:50 AM

I've figured out the doing this.

clientName between 'B' and 'D'

Gets converted into this.

clientName >= 'B' and clientName <= 'D'

So in the end the two statements are the same. Can anyone explain why
values starting with the letter D are not returned by these two
queries?

Since 'D' is not returned how would I go about returning the Z values
of this?

clientName between 'V' and 'Z'

My first try at returning 'Z' is the follow but it seems like there
should be a better way.

clientName between 'V' and 'Z' or clientName >= 'Z'

Regards,

Aaron
reply

Thank you both.The syntax clientName like '[A-D]%' worked very well. - mohaaro

Friday, April 11, 2008 2:50 AM

Thank you both.

The syntax clientName like '[A-D]%' worked very well. The use of the
index in this case is a nice bonus.

Aaron
reply

using between with character values - Karim Moussa

Friday, April 11, 2008 9:23 AM

Aaron,

I am glad that you have solved your problem.

Regards,

Karim
Thank you both.

The syntax clientName like '[A-D]%' worked very well. The use of the
index in this case is a nice bonus.

Aaron
reply