Solved

SQL WHERE field LIKE any number

Posted on 2010-09-13
2
273 Views
Last Modified: 2012-05-10
I am using
- MSAccess
- Microsoft SQL Server  2000 - 8.00.760 (Intel X86)
- FrontPage 2003

I am trying to pull a report for a list of titles that being with a number 0-9. I have the following code working for an alphabet search:

      "WHERE BookTitle LIKE 'B%' and ACTIVE LIKE 'Yes' "

Do I have to do an OR statement for each number or is there a an inclusive code?

0
Comment
Question by:JLohman
2 Comments
 
LVL 4

Accepted Solution

by:
ericnils earned 250 total points
ID: 33663791
Try this:

"WHERE BookTitle LIKE '[0-9]%' and ACTIVE LIKE 'Yes' "
0
 
LVL 47

Assisted Solution

by:Dale Fye (Access MVP)
Dale Fye (Access MVP) earned 250 total points
ID: 33663917
Disagree with using like for an exact comparison.  Recommend:

WHERE [BookTitle] Like '[0-9]%' AND [Active] = 'Yes'
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question