Using a Subquery in CONTAINS

  • Hi 🙂

    I am using a CONTAINS statement and need to do a subquery inside the statement.

    For example:

    CONTAINS([MyCol], (SELECT [MyCol2] FROM [MyTable]))

    Obvisouly, this isn't allowed...

    Does anybody have a solution to this that doesn't require creating dynamic SQL?

    Cheers

    Rob

  • I guess you should put the MyCol2 in a variable and use that in the CONTAINS.

    If you want better tested results, you should give some table descriptions, sample data and desired output as described in the link below.

    Ronald HensbergenHelp us, help yourself... Post data so we can read and use it: http://www.sqlservercentral.com/articles/Best+Practices/61537/-------------------------------------------------------------------------2+2=5 for significant large values of 2

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply