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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to do "Between" on specific letters in a name

Status
Not open for further replies.
Joined
Dec 11, 2009
Messages
60
Location
US
I have a large file and I want to break it down by lastname. Is there a way I can do lastname between (a and c)?

Thanks,
 
The best way is....

[tt][blue]Where LastName Like '[a-c]%'[/blue][/tt]

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Code:
DECLARE @Test TABLE (Fld1 varchar(200))

INSERT INTO @Test VALUES ('Abra')
INSERT INTO @Test VALUES ('Adam')
INSERT INTO @Test VALUES ('Boris')
INSERT INTO @Test VALUES ('Cccccccc')
INSERT INTO @Test VALUES ('Dunkan')

SELECT * 
       FROM @Test
WHERE Fld1 COLLATE SQL_Latin1_General_Cp1_CI_AI  BETWEEN 'A' AND 'C'
NOT TESTED PROPERLY!

Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top