Wild card search in AS/400 query

40 pts.
Tags:
AS/400
AS/400 Query
Wildcard
How do I find records that actually have percent sign in them using the like '%  "%"  %' when the % is the wild card?

Software/Hardware used:
AS/400 Query

Answer Wiki

Thanks. We'll let you know when a new response is added.

Is it always in the same position in the file?

Discuss This Question: 8  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    What query tool are you using? OPNQRYF? SQL? Query Manager? Query/400? Web Query? ODBC? Something else? -- Tom
    125,585 pointsBadges:
    report
  • tracyv29
    I have the same question.  I want to find embedded percent signs as well as embedded apostrophes within a text field using AS/400 Query.  Some of our text fields contain only a % or an ' and I want to use the LIKE.
    40 pointsBadges:
    report
  • BigKat
    You use the ESCAPE clause in the SQL statement to declare a symbol to mark the special character as a literal character. SELECT * FROM TABLE WHERE C1 LIKE '%+%%' ESCAPE '+' first '%' is wild card, '+%' is a character literal of a percent sign, and the third '%' is wild card; therefore, above will find any row where C1 contains a percent sign
    8,100 pointsBadges:
    report
  • BigKat
    single quote is just SELECT * FROM TABLE WHERE C1 LIKE '%''%' single quote, percent sign, single quote, single quote, percent sign, single quote
    8,100 pointsBadges:
    report
  • tracyv29
    I want to know if it is possible to do in AS/400 Query, not SQL
    40 pointsBadges:
    report
  • philpl1jb
    No.  A query/400 can be converted to QM Query and the resultant SQL code can be edited as shown by BigKat. 
    49,850 pointsBadges:
    report
  • tracyv29
    Not the answer I was hoping for, but thanks guys!
    40 pointsBadges:
    report
  • TomLiotta
    I want to know if it is possible to do in AS/400 Query, not SQL   A SQL query is an AS/400 query; there are many kinds of AS/400 queries. If you mean that you actually want to use the old, practically obsolete, inefficient Query/400 or Query for iSeries  product, I don't know of a good way to escape the '%' symbol without using SQL. (V5R3 at least can show "Query" as the product name in the list of installed products.) One might exist; I just haven't seen one.   The best answer is simply not to keep using the old query product for anything new, and convert old queries to new ones. (That doesn't apply to the recent Web Query product.)   Some of our text fields contain only a % or an ‘ and I want to use the LIKE.   If a field contains only a percent or apostrophe symbol, the LIKE function shouldn't be used. Just use "equal".   Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following