all groups > sql server full text search > august 2005 >
You're in the

sql server full text search

group:

search for a specific datetime within an XML...


search for a specific datetime within an XML... mehdi_mousavi
8/30/2005 3:41:38 AM
sql server full text search: Hi,
Consider the following xml snippet that's being kept as an image
datatype within the Sql Server 2000 SP3 running under a W2K Advanced
Server machine:

....Removed For Breviry...
<Sal d2p1:Beginning="2005-07-30T14:46:24.7330000+04:30"
d2p1:Finishing="2005-07-30T14:46:42.9230000+04:30">
<Id d2p1:AreaCode="711">
<PhoneNumber>8240000</PhoneNumber>
</Id>
....Removed For Breviry...

The question is that how can I write a contains_search_condition for a
specific beginning date, say, 2005-07-30?

0 records are (wrongly) affected by the following sql:

SELECT ID FROM mytable WHERE CONTAINS(the_xml_col, '
"d2p1:Beginning="2005-07-30*"" ')

whilst this one returns the correct results:

SELECT ID FROM mytable WHERE CONTAINS(the_xml_col, '
"d2p1:Beginning="2005-07-30T14:46:24.7330000+04:30"" ')

What is going wrong? Any help would be highly appreciated,

Cheers,
Mehdi
Re: search for a specific datetime within an XML... Hilary Cotter
8/30/2005 10:39:48 AM
SQL FTS is good for token searches, but not really for numbers or dates the
way you are querying it.

You can't query an element's value or an attribute's value, but you can
query the child elements values.

You can't search specific element or attribute values.

However in SQL 2005 you can query XML using SQL FTS and then use an XQuery
contains to do a literal search of an element or attribute value.

--
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
[quoted text, click to view]

Re: search for a specific datetime within an XML... mehdi_mousavi
8/31/2005 1:19:32 AM
Well, how can i search for a phrase containing double quotes? for
example: "myname" including the double quotes...

Any idea?

Thanks
Re: search for a specific datetime within an XML... Hilary Cotter
9/1/2005 10:01:02 AM
you can't. It isn't indexed.

--
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
[quoted text, click to view]

AddThis Social Bookmark Button