Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL CONTAINS OPERATOR

Status
Not open for further replies.

laker67

Programmer
Jan 18, 2004
31
US
Hi!!!
I was wondering how CONTAINS work in a dynamic sql statement where i have more than one table to join as below.
FULL TEXT IS ENABLED ON TABLE emp
This works.
Code:
select s.id from emp s
 WHERE CONTAINS(*, '"test"')

This does not work
Code:
select s.id from emp s,emp1 s1
 WHERE CONTAINS(*, '"test"')
and s.id=s1.id

I know the problem is * . But not sure how to use this just for emp table and not emp1 table
 
select s.id from emp s,emp1 s1
WHERE CONTAINS(emp.*, '"test"')
and s.id=s1.id

But why do you do a search on all he columns of emp.
eg if you're searching in a descrption column only, it will be a lot quicker :

select s.id from emp s,emp1 s1
WHERE CONTAINS(emp.description, '"test"')
and s.id=s1.id

--------------------------------------------------
[highlight]Django[/highlight] [thumbsup]
bug exterminator
tips'n tricks addict
 
The reason i use * is the table has around 80 columns .out of which 50 columns are full text enabled . so inorder to validate all the 50 columns i use '*' rather than mentioning each column with a 'or' clause.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top