MS SQL单词之间包含空格

时间:2019-01-31 08:13:33

标签: sql sql-server full-text-search full-text-indexing

我具有以下ms sql语法来查找所有包含这些单词的行:

import xml.etree.ElementTree as ET
import xmltodict
import json

myxml = """
 <mydocument has="an attribute">
   <and>
     <many>elements</many>
     <many>more elements</many>
   </and>
   <plus a="complex">
     element as well
   </plus>
 </mydocument>
 """
#rename tag
root = ET.fromstring(myxml)
for elem in root.iter('plus'):
    elem.tag = 'children'

newxml = ET.tostring(root, encoding='utf8', method='xml')
xml_dict = dict(xmltodict.parse(newxml)) #convert to Ordered dict and then a normal dict(optional, OrderedDict is returned by default if only using xmltodict)
print(json.dumps(xml_dict, indent=4)) #pretty print to view dict tree(optional)
#Output:
 {
    "mydocument": {
        "@has": "an attribute",
        "and": {
            "many": [
                "elements",
                "more elements"
            ]
        },
        "children": {
            "@a": "complex",
            "#text": "element as well"
        }
    }
}

这是我的数据库列,搜索正在其中:

enter image description here

我只想要带有黄色标记的行,但是我得到了全部4行。

怎么了?

2 个答案:

答案 0 :(得分:0)

我认为通配符会带来误报。请尝试以下操作:

select * from Expat_MA 
where CONTAINS (zusammen,'hans AND "Level 4"');

答案 1 :(得分:0)

也许尝试一下:

*