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)
 complex query with XPATH needed

Author  Topic 

johhnyfrench
Starting Member

1 Post

Posted - 2009-05-08 : 10:11:12
Hi,

I have a very difficult query to perform i dont know if its event possible. I basically have 3 tables.

tblText
---
ID, Title, Summary, Text

tblPanels
--------
PageID, PanelID, XMLData

tblPages
---------

PageID, Title, IsLive

I want a search which will search the tblText table and match on any words in Title, Summary or Text..

so something like SELECT * FROM tblText where Title LIKE '% string passed in '% etc..

I want this to return the ID for all rows it finds. I then want to use this ID to do a XPATH statement on the XMLData in the tblPanels table. The XmlData looks like

<head><data><Textid>1</Textid><type>text area</type></data></head>

so it would xpath to ID node ..if i matches ID to the Textid node then I want to return that row from the tblData table so i get the PageID...then finally I want to use the PageID to query the tblPages table to return the Title. In my search results I want to return

Title = from tblPages

also a nice to have would be to return the body of text found +- 200 chars..

is this query even possible?...

its a tough one
thanks for your time though

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-06-17 : 03:31:55
See http://weblogs.sqlteam.com/peterl/archive/2008/09/01/Updated-XML-search-test-case-with-variables.aspx


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -