Re: CONTAINS and wildcard



jhofmeyr@xxxxxxxxxxxxxx wrote:
On Oct 29, 8:59 pm, Sharif Islam <mis...@xxxxxxxxxxxxxxx> wrote:
Is it a good idea to have multiple contains? I have this query:

Select * from myTable where contains (Col1, 'Africa') or (Col2, 'Africa')

Also, I tried this, didn't return anything:

Select * from myTable where contains (Col1, 'Africa*') or (Col2, 'Africa')

Both Col1 and Col2 has the string 'Africa' and 'African' in it.

--sharif

Hi Sharif,

What version of SQL Server are you using? What is the error message
you are getting? Is the table configured for Full-Text Indexing?

Also - your syntax for the CONTAINS statement is incorrect. Try:
SELECT *
FROM myTable
WHERE CONTAINS(Col1, '"Africa*"')
OR CONTAINS(Col2, '"Africa*"')

ah, that was it, thanks!

--sharif
.



Relevant Pages

  • "The parameter is incorrect" error, adding table in Database Explorer
    ... Whenever I attempt to "Add New Table" to a SQL Server 2005 Express database ... get a pop up error message stating "The parameter is incorrect". ...
    (microsoft.public.vsnet.general)
  • Re: Sql Query Needed
    ... Am I guessing correct that SQL Server finds ... the syntax to be incorrect near '='? ...
    (microsoft.public.sqlserver.server)
  • Re: Sql Query Needed
    ... Am I guessing correct that SQL Server finds ... the syntax to be incorrect near '='? ...
    (microsoft.public.sqlserver.tools)
  • User Account
    ... Panel I get the following error message: ... directory name or syntax is incorrect." ...
    (microsoft.public.windowsxp.perform_maintain)
  • Re: Help with SQL query in script
    ... sure why the syntax is wrong.... ... ERROR: Microsoft OLE DB Provider for SQL Server: Line 12: Incorrect ... I need to run a daily report of contract expirations for ...
    (microsoft.public.scripting.vbscript)