|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (7 bit)
Join Date: Sep 2002
Location: Middlesbrough, UK
Posts: 108
|
CONTAINS statement in SQL
i am using ASP and an access database, and i'm trying to do a search facility using the CONTAINS statement, but i keep getting this error.-
Microsoft JET Database Engine error '80040e14' Syntax error (missing operator) in query expression 'CONTAINS(cusemail, 'chris', 1) > 0'. the whole statement in sql is.- set objRSManu = server.CreateObject("ADODB.Recordset") sql = "SELECT score(1), orderdate, cusemail from Orders WHERE CONTAINS(cusemail, 'chris', 1) > 0" objRSManu.open sql , Conn this search should return all the records that have "chris" in the email address, what am i doing wrong!! |
|
|
|
|
|
#2 |
|
Member (7 bit)
Join Date: Sep 2002
Location: Middlesbrough, UK
Posts: 108
|
been told this should work too.-
SELECT id FROM orders WHERE CONTAINS (cusemail, 'chris') > 0 but it doesn't ![]() please help |
|
|
|
|
|
#3 |
|
Professional gadfly
|
CONTAINS can't be used in Access databases. It can only be used with SQL Server. The version of SQL that Access uses does not have that functionality; at least my version of Access 2000 doesn't.
|
|
|
|
|
|
#4 |
|
Member (7 bit)
Join Date: Sep 2002
Location: Middlesbrough, UK
Posts: 108
|
cheers doctor, i think you are right!
i have however tried it with SQL Server as well, though i didnt get an error message after making the table full-text indexed, it doesnt return any records either.. any ideas anyone? |
|
|
|
|
|
#5 |
|
Professional gadfly
|
What is the ">0" doing there? Have you tried using it without the >0?
|
|
|
|
|
|
#6 |
|
Member (7 bit)
Join Date: Sep 2002
Location: Middlesbrough, UK
Posts: 108
|
yeah i did try it without it
its something to do with scores, and how the contains operator grades its matches, if theres a match it gives it an index greater than 0, the example i "borrowed" the statement from had that clause in. |
|
|
|
|
|
#7 |
|
Professional gadfly
|
Hmm, the T-SQL reference I have for SQL Server doesn't say much about weighting.
Excactly what records are you trying to return? Have you tried using a wildcard? For example, if you want to return all records where cusemail starts with "chris", use "SELECT id FROM orders WHERE CONTAINS (cusemail, 'chris*') If all else fails, could LIKE work? For example, "SELECT id FROM orders WHERE cusemail LIKE 'chris*'" I usually use LIKE in queries. |
|
|
|
|
|
#8 |
|
Member (7 bit)
Join Date: Sep 2002
Location: Middlesbrough, UK
Posts: 108
|
not tried it with * yet, but i will do
got some like statements that work, and they work in Access too !! |
|
|
|
|
|
#9 |
|
Professional gadfly
|
Yes, LIKE works with Acess SQL, which is why I tend to use them more (I started with Access and then moved to SQL Server).
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|