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

More wildcard characters?

Status
Not open for further replies.

blue77

Technical User
Nov 1, 2001
11
0
0
GB
I am trying to create a query to search a field and retrieve records that contain specific characters within a string. The obvious answer is to use wildcards. But let me try and elaborate: Below are 3 records in a dataset. All of these records contain the character combination “14”.

Record 1. “114; 244; 142; 14; 144”
Record 2. “377; 210; 68; 144; 444”
Record 3. “14; 237; 114”

I would like to query these records for the number “14” only. So, a successful query would retrieve Record 1 and Record 3. If I use the wildcard character “*”, then the query result set will contain all 3 records, so this is out of the question.

Is there another wildcard character that I can use that will allow me to search for records that specifically contain the number “14”? (as opposed to “114”).

I hope I am making myself clear. This is quite new to me.
I would appreciate any answers.
 

Do all the records contain the semi-colon between the numbers? If they do the following should work. It handles 3 conditions - number is between other numbers in the column, number is at the end of column and number is at the start of the column.

Select * From Table
Where col Like "* 14;*"
Or col Like "* 14"
Or col Like "14;*" Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Thanks Terry

Not all the strings contain semi-colons, but that will certainly help reduce the result set.
It's a pity that there isn't a simpler way

Nick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top