Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Problem with text search

Author  Topic 

thiyait
Yak Posting Veteran

70 Posts

Posted - 2006-05-18 : 06:24:19
Hi all;
Anyone help me to overcome this problem


Table1:

EMP
---
Rajasekar
tim

Table2:

Description:
------------
this is the sample tim
this is another sample


i just need the result of emp from table1 which is contained in table 2 description

Here my expected result is

Emp
---
tim

i have tried with following query:

Select emp from Table1 A,Table2 B Where b.Description like '''%'+ a.EMP +'%'''

it retrieved nothing


Thanks in advance

Thiya

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-05-18 : 06:37:48
Try this


Declare @tblEmp Table
(
Emp Varchar(100)
)

Insert @tblEmp
Select 'Rajasekar' Union All
Select 'tim'

Declare @TblDesc Table
(
Description Varchar(100)
)
Insert @TblDesc
Select 'this is the sample tim' Union All
Select 'this is another sample'

Select Emp From @tblEmp Inner Join @TblDesc On
Description Like '%' + Emp + '%'



If Debugging is the process of removing Bugs then i Guess programming should be process of Adding them.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-05-18 : 08:04:20
>>Select emp from Table1 A,Table2 B Where b.Description like '''%'+ a.EMP +'%'''

You overquoted Single quote as if you were using Dynamic SQL

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -