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

finding records beginning with single quote 1

Status
Not open for further replies.

stinkybee

Programmer
May 15, 2001
218
GB
I am trying to implement a standard browse feature on a web page where the user can select a to z or miscellaneous. All records with where the "title" field begins with that letter are then displayed. My problem is that I have noticed that when trying to display the "Miscellaneous" records, as in, the ones that do not begin with a letter, a record that has the "title" field beginning with a single quote ( ' ) is not displayed.

I am using a simple sql statement as follows

Code:
SELECT * FROM test WHERE title NOT BETWEEN 'A' AND 'Z'

Other characters and numbers etc work fine, just not the single quote. Also, if I search for it explicitly it works fine. eg

Code:
SELECT * FROM test WHERE title = '''test'

Any help on this would be gratefully received.



 
How about a work-around?

Code:
SELECT t.Title, *
FROM t
WHERE Replace([Title],"'","1") Not Between "A" And "Z"
 
What about this ?
SELECT * FROM test WHERE NOT (title LIKE '[A-Z]*'

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
OOps, sorry for the missing closing paren.
 
Thanks for the reply. Had to make a slight change but this works

SELECT * FROM test WHERE NOT (title LIKE '[A-Z]%')
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top