Sql 为什么搜索[help/Don ask]会在DSE中返回不相关的结果?

Sql 为什么搜索[help/Don ask]会在DSE中返回不相关的结果?,sql,data.stackexchange.com,Sql,Data.stackexchange.com,为什么在data.stackexchange.com上返回的结果在注释文本中没有[帮助/不问]?我觉得我错过了一些显而易见的东西 select top 10 Id, PostId, Text from comments where text like '%[help/dont-ask]%' 我目前得到的结果: Id PostId Text -- ------- ----------------------------------- 1 35314 not sure why thi

为什么在data.stackexchange.com上返回的结果在注释文本中没有
[帮助/不问]
?我觉得我错过了一些显而易见的东西

select top 10 Id, PostId, Text
from comments
where text like '%[help/dont-ask]%'
我目前得到的结果:

Id PostId Text -- ------- ----------------------------------- 1 35314 not sure why this is getting downvoted -- it is correct! Double check it in your compiler if you don't believe him! 2 35314 Yeah, I didn't believe it until I created a console app - but good lord! Why would they give you the rope to hang yourself! I hated that about VB.NET - the OrElse and AndAlso keywords! 4 35195 I don't see an accepted answer now, I wonder how that got unaccepted. Incidentally, I would have marked an accepted answer based on the answers available at the time. Also, accepted doesn't mean Best :) 9 47239 Jonathan: Wow! Thank you for all of that, you did an amazing amount of work! 10 45651 It will help if you give some details of which database you are using as techniques vary. 12 47428 One of the things that make a url user-friendly is 'discover-ability', meaning you can take a guess at url's simply from the address bar. http://i.love.pets.com/search/cats+dogs could easily lead to http://i.love.pets.com/search/pug+puppies etc 14 47481 I agree, both CodeRush and RefactorPro are visually impressive (most of which can be turned off BTW), but for navigating and refactoring Resharper is much better in my opinion of using both products. 15 47373 Just wanted to mention that this is an excellent solution if you consider the problem to be linear (i.e. treating `A1B2` as a single number). I still think the problem is multi-dimensional, but I guess we'll just have to wait for the author to clarify :) 16 47497 Indeed, the only way to do this is get the server to generate your CSS file which can be done in many ways depending on which language you are using. HttpHandlers are common in C#. You could use jQuery or the likes to add styling to every element with the class 'ourColur' and parametrise your JS 18 47513 This advice goes against the spirit of CSS, which is separation of content and presentation. You way requires changing HTML for presentation sake, and stating in content which elements have same color. Id发布文本 -- ------- ----------------------------------- 135314不知道为什么这会被否决——这是正确的!如果你不相信他的话,在你的编译器里再检查一遍! 235314是的,直到我创建了一个控制台应用程序,我才相信这一点——但天哪!他们为什么要给你绳子吊死自己!我讨厌VB.NET——OrElse和AndAlso关键字! 4 35195我现在看不到一个被接受的答案,我想知道这是怎么被拒绝的。顺便说一句,我会根据当时可用的答案标记一个可接受的答案。此外,接受并不意味着最好:) 乔纳森:哇!谢谢你,你做了大量的工作! 10 45651如果您提供一些关于您使用的数据库的详细信息,这会有所帮助,因为技术不同。 12 47428使url用户友好的一个因素是“发现能力”,这意味着您可以简单地从地址栏猜测url。http://i.love.pets.com/search/cats+狗很容易导致死亡http://i.love.pets.com/search/pug+小狗等 14 47481我同意,CodeRush和RefactorPro在视觉上都给人留下了深刻的印象(顺便说一句,其中大多数都可以关闭),但在导航和重构方面,我认为使用这两种产品的Resharper要好得多。 15 47373只是想提一下,如果你认为这个问题是线性的(即把A1B2作为一个数字来处理),这是一个很好的解决方案。我仍然认为问题是多方面的,但我想我们只能等待作者澄清:) 16 47497事实上,实现这一点的唯一方法是让服务器生成您的CSS文件,这可以通过多种方式完成,具体取决于您使用的语言。HttpHandler在C#中很常见。您可以使用jQuery或类似的工具为每个元素添加样式,并使用类“ourColur”和参数化JS 18 47513此建议与CSS的精神背道而驰,CSS将内容和表示分离。您需要更改HTML以便于表示,并在内容中说明哪些元素具有相同的颜色。
…其中没有一个包含神奇链接(甚至是文本
dont ask
)。

因为
[]
限定了要查找的一组字符

你需要这样做

或者只需使用
CHARINDEX
,因为搜索仍然有效


有趣的是,我不知道为什么我可能,可能,用T-SQL做了这么多,包括很多像s这样的
,但我不知道?!我确实错过了一些显而易见的东西。谢谢
WHERE CHARINDEX('[help/dont-ask]', text) > 0