I don't have much time right now to think on more optimize solution on your problem, but this code should help you out.
CREATE FUNCTION dbo.match (@resume varchar(100),@keyword varchar(10))
RETURNS bit
WITH EXECUTE AS CALLER
AS
BEGIN
Declare @flag bit
Select @flag = case when exists(select 1
from resume_header rh join resume r
on rh.rh_id=r.rid
where contains(resume_title,@keyword) and
contains(resume,@keyword))
then 1
end
return @flag
end
here you run it
declare @yesno bit
select @yesno=dbo.match ('java','jaaava')
select isnull(@yesno ,'FALSE') as found
Regards
Shrikant Kulkarni