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 2005 Forums
 Transact-SQL (2005)
 SQL Error - field cannot be bound

Author  Topic 

matthisco
Starting Member

48 Posts

Posted - 2010-07-01 : 10:17:56
Hi Folks,

This query gives me the following error:

SELECT f.rank, pagebody, pagesummary, pagetitle, pageid,pages.siteid, sites.siteid FROM pages, FREETEXTTABLE(pages, pagebody, 'sandwell') f INNER JOIN sites ON pages.siteid = sites.siteid WHERE pages.pageid=f.[key] ORDER BY rank DESC;

Error:

The multi-part identifier "pages.siteid" could not be bound.

Can anyone please help?

Thankyou

Sachin.Nand

2937 Posts

Posted - 2010-07-01 : 10:38:58
[code]
SELECT f.rank, pagebody, pagesummary, pagetitle, pageid,pages.siteid, sites.siteid
FROM pages INNER JOIN FREETEXTTABLE(pages, pagebody, 'sandwell') f
ON pages.pageid=f.[key]
INNER JOIN sites ON pages.siteid = sites.siteid
ORDER BY rank DESC;
[/code]



Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless.

PBUH
Go to Top of Page

matthisco
Starting Member

48 Posts

Posted - 2010-07-02 : 04:53:05
Thankyou for your reply.

Can you add a contains aswell as freetexttable in the same query with rank?

Something like this:

SELECT f.rank, pagebody, pagesummary, pagetitle, pageid,pages.siteid, sites.siteid
FROM pages

INNER JOIN FREETEXTTABLE(pages,pagebody, '#searchterm#') f
ON pages.pageid=f.[key]

INNER JOIN CONTAINS(pagebody, '"#searchterm#*"') f
ON pages.pageid=f.[key]

INNER JOIN sites ON pages.siteid = sites.siteid
ORDER BY rank DESC;

but it genrates the error:

Incorrect syntax near the keyword 'CONTAINS'.
Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2010-07-02 : 06:30:16
I doubt you can do that.But maybe I am wrong.
You can do something like this.

select * from
(
SELECT f.rank, pagebody, pagesummary, pagetitle, pageid, sites.siteid
FROM pages INNER JOIN FREETEXTTABLE(pages, pagebody, 'sandwell') f
ON pages.pageid=f.[key] INNER JOIN sites ON pages.siteid = sites.siteid
)T INNER JOIN CONTAINS(pagebody, '"#searchterm#*"') f
ON T.pageid=f.[key] ORDER BY rank DESC;







Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless.

PBUH
Go to Top of Page

matthisco
Starting Member

48 Posts

Posted - 2010-07-02 : 06:48:30
Thanks very much
Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2010-07-02 : 07:04:39
So is it working?


Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless.

PBUH
Go to Top of Page
   

- Advertisement -