Multiple SELECT CONTAINSTABLE conditionals

zequion 446 Reputation points
2024-09-23T03:23:37.85+00:00

I have a SQL code that exceeds the 4000 character limit and I'm trying to split it.


I want to perform 2 o more SELECT CONTAINSTABLE (there may be more) with the second Select being conditional on the first in AND/OR mode.

If the condition is AND and the first Containstable contains results, the second Containstable would be executed. If the first Containstable has no results, the second would not be executed.

If the condition is OR, the second Containstable would be executed even if the first one has no results.

The final result depends on the conditions. If the first Select has results but the second does not, then the AND condition is not met and there are no final results.

If the condition is OR and there are results, there cannot be repeated records.

It is required to be able to order including RANK. I think if multiple Select are used, Rank would not be correct.

I also have the problem that I use synonyms and word inflections and, depending on the words being searched for, with just 1 or 2 words the limit of 4000 for Containstable is exceeded. Also, it seems that the limit for a normal Select is 1024 characters.



SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,494 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.