You need to sign in to do that
Don't have an account?

Sql query that contains digit
I am trying to extract the data via data loader, I am looking for the following criteria.
First Name contains 0,1,2,3,4,5,6,7,8,9
How do I put this in the SQL query?
First Name contains 0,1,2,3,4,5,6,7,8,9
How do I put this in the SQL query?
It looks ugly, but works fine.
All Answers
Try using LIKE operator in SOQL query. Here is a snippet from documentations -
Expression is true if the value in the specified fieldName matches the characters of the text string in the specified value. The LIKE operator in SOQL and SOSL is similar to the LIKE operator in SQL; it provides a mechanism for matching partial text strings and includes support for wildcards.
- The % and _ wildcards are supported for the LIKE operator.
- The % wildcard matches zero or more characters.
- The _ wildcard matches exactly one character.
- The text string in the specified value must be enclosed in single quotes.
- The LIKE operator is supported for string fields only.
- The LIKE operator performs a case-insensitive match, unlike the case-sensitive matching in SQL.
- The LIKE operator in SOQL and SOSL supports escaping of special characters % or _.
- Don’t use the backslash character in a search except to escape a special character.
For example, the following query matches Appleton, Apple, and Appl, but not Bappl:Thanks
Prafull
This is my query , but I am not getting the expected result.
Select Id, LastName, FirstName, City, Country, Email, IsActive, IsPortalEnabled FROM User WHERE IsActive = True AND IsPortalEnabled = True AND FirstName like '[0-9]%'
AND (FirstName LIKE '1%' OR Name LIKE '2%' OR...)
It looks ugly, but works fine.
You may need to consider FirstName LIKE '%1%'
regards
Andrew