Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6938457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:29:46+00:00 2026-05-27T12:29:46+00:00

I have an SQL with around 50 OR condition and all with Like operator.

  • 0

I have an SQL with around 50 “OR” condition and all with “Like” operator. I execute this SQL from a VB Access code.

But the query fails saying, “Expression Too Long” error (mostly I think, because it exceeds 1024 characters in the query grid.

SELECT * 
  FROM <My Database> 
 WHERE (
        [Title] = '' 
        OR [Title] = '' 
        OR [Title] = '' 
        OR [Title] = '' 
        OR [Title] = '' 
        OR [Title] = '' 
        OR [Title] = '' 
        OR [Title] = '' 
        OR [Title] = '' 
        OR [Title] = ''
       ) 
       AND (
            [TITLE] LIKE '*Afghanistan*' 
            OR [TITLE] LIKE '*Term1*' 
            OR [TITLE] LIKE '*Term2*' 
            OR [TITLE] LIKE '*Term3*' 
            OR ..<around 40 like these> 
            OR [COUNTRY] LIKE '*Country1*' 
            OR ...<around 40 like these>
           );

Any ideas or suggestions as to how to work around this issue?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:29:47+00:00Added an answer on May 27, 2026 at 12:29 pm

    Suggestions: insert parameter values into base “staging” tables (possibly in another temp database) and create seni joins to these tables using EXISTS. Use ALIKE (rather than LIKE), which always uses Standard SQL wildcard characters (%).

    SELECT * 
      FROM MyTable AS m
     WHERE EXISTS (
                   SELECT * 
                     FROM MyExactParams AS x
                    WHERE m.Title = x.Title
                  )
           AND (
                EXISTS (
                        SELECT * 
                          FROM MyPatternParams AS p
                         WHERE m.Title ALIKE '%' + p.Title + '%'
                       )
                OR EXISTS (
                           SELECT * 
                             FROM MyPatternCountries AS c
                            WHERE m.Country ALIKE '%' + c.Country + '%'
                          )
               );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have sql statement like this SELECT DISTINCT results_sp_08.material_number FROM results_sp_08 INNER JOIN courses
I have a sql query that runs super fast, around one second, when not
I have SQL data that looks like this: events id name capacity 1 Cooking
I have a tree-like model where in all situations but one , I want
I have a SQL query that seems to be producing correct results but according
I have been having some issues with LINQ-To-SQL around memory usage. I'm using it
I have a SQL Server 2000 database with around a couple of hundred tables.
I have a SQL 2000 database with around 10 million rows and I need
I have a stored procedure that runs custom backups for around 60 SQL servers
I have SQL query, which is working nice on Oracle and MSSQL. Now I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.