473,287 Members | 1,650 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

trouble using the CONTAINS() function in sql server

I am having trouble using the CONTAINS function in sql
server(enterprise manager). I am typing the following:

Select *
FROM mytable
WHERE CONTAINS(myfield,'mystring')

This returns the error:

Query Designer encountered a MS Design Tools error:
ODBC error:[Microsoft][ODBC SQL Server Driver]'CONTAINS' is not a
recognized
function name.[Microsoft][ODBC SQL Server Driver][SQL
Server]Statement(s) could
not be prepared.

According to the T-SQL reference on msdn this is a supported function?
Am I typing something incorrectly? If this is not supported, is
there an equivalent to this function? In my field I have some comma
delimited values ie 'apple,orange'. So I need to be able to discern
which records contain orange. The LIKE keyword doesn't seem to work
for this scenario. Any help would be greatly appreciated.
Jul 20 '05 #1
3 52176
Works for me. Just add it directly to the SQL statement, unless you're
using an older SQL Server version than 2000?

Another way to do this is to use LIKE, as you mentioned:

select * from mytable where myfield like '%orange%'

HTH,
Dave
"Jason" <jf******@yahoo.com> wrote in message
news:ec**************************@posting.google.c om...
I am having trouble using the CONTAINS function in sql
server(enterprise manager). I am typing the following:

Select *
FROM mytable
WHERE CONTAINS(myfield,'mystring')

This returns the error:

Query Designer encountered a MS Design Tools error:
ODBC error:[Microsoft][ODBC SQL Server Driver]'CONTAINS' is not a
recognized
function name.[Microsoft][ODBC SQL Server Driver][SQL
Server]Statement(s) could
not be prepared.

According to the T-SQL reference on msdn this is a supported function?
Am I typing something incorrectly? If this is not supported, is
there an equivalent to this function? In my field I have some comma
delimited values ie 'apple,orange'. So I need to be able to discern
which records contain orange. The LIKE keyword doesn't seem to work
for this scenario. Any help would be greatly appreciated.

Jul 20 '05 #2
I've never used contains.... Have you tried CharIndex?

Ex:
Select *
FROM tablename
where charindex('stringtofind',column) > 0

Scott


jf******@yahoo.com (Jason) wrote in message news:<ec**************************@posting.google. com>...
I am having trouble using the CONTAINS function in sql
server(enterprise manager). I am typing the following:

Select *
FROM mytable
WHERE CONTAINS(myfield,'mystring')

This returns the error:

Query Designer encountered a MS Design Tools error:
ODBC error:[Microsoft][ODBC SQL Server Driver]'CONTAINS' is not a
recognized
function name.[Microsoft][ODBC SQL Server Driver][SQL
Server]Statement(s) could
not be prepared.

According to the T-SQL reference on msdn this is a supported function?
Am I typing something incorrectly? If this is not supported, is
there an equivalent to this function? In my field I have some comma
delimited values ie 'apple,orange'. So I need to be able to discern
which records contain orange. The LIKE keyword doesn't seem to work
for this scenario. Any help would be greatly appreciated.

Jul 20 '05 #3
Great thanks for your help. After posting this question I read on msdn
that some keywords are new for sql server 2000. The "contains" function
is on that list. I tried LIKE "%mystring%" and it works fine!!
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: David C. Holley | last post by:
How would I run a JavaScript function in a *.asp page and then pass the value returned to VBScript for further processing? ***Converting the function to VBScript is *NOT* an option.
2
by: serge calderara | last post by:
Dear all, I am populating a treeview control with an XML file. I need to skip duplicate node entry from XML file in treeview if exit For that I ma using the following line of code : If...
2
by: sprungli | last post by:
My goal is to select some XPath nodes based on whether their values (text) contain a string passed as argument. To achieve this I use the contains() function of XPath in an XpathExpression. For...
4
by: BravesCharm | last post by:
I am trying to connect to SQL Server 2005 Express with Visual C# 2005 Express using this code: static void Main(string args) { SqlConnection conn = new SqlConnection(@"Data...
5
by: tkondal | last post by:
Hi all. I just started looking at Python's ctypes lib and I am having trouble using it for a function. For starters, here's my Python code: from ctypes import*; myStringDLL=...
13
by: arnuld | last post by:
this does not work, i know there is some problem in the "for loop" of "print_arr" function. i am not able to correct the weired results i am getting. i have no compile time error, it is only...
0
by: kc7zdm | last post by:
I'm using Oracle intermedia text indices in my database, and the Contains function from a VB.Net program using the system.data.oracleclient provider. When a query includes a number as a search term,...
0
by: Maxx57 | last post by:
C# VS.Net 1.1 (2003) - trouble with using IE proxy server settings I've got a program that detects if it can connect to a webservice. It sends a System.Net.WebRequest and then checks the...
8
by: SMJT | last post by:
Does anyone know why the string contains function always returns true if the token is an empty string? I expected it to return false. "AnyOldText".Contains("") or...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.