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!

How to search on a specific character in a field?

Status
Not open for further replies.

mhall

Technical User
Sep 26, 2000
13
GB
Hi

I have a database which contains drawing numbers, the first 5 characters are a sequential number, the last three can alter depending on what type of drawing it is. eg 01234PAP. I know how to search this field for a character but the letter A can exist in position 7 and 8 and I only want the records that have A in position 7 (00000*A*). can any one help me.

Thanks

Matt


 

Here are two solutions.

Use the underscore '_' as a wildcard for the first 6 characters.

SELECT *
FROM table1
WHERE DrawingNo Like '______A%'

Use the substring function.

SELECT *
FROM table1
WHERE substring(DrawingNo,7,1)='A' Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top