你想要一些东西。首先,查找 SQL Server 的函数语法,并编写如下内容:
-- Warning! Code written off the top of my head,
-- don't expect this to work w/copy-n-paste
create function removeStrings(@input nvarchar(4000))
as begin
-- We're being kind of simple-minded and using strings
-- instead of regular expressions, so we are assuming a
-- a space before and after each word. This makes this work better:
@input = ' ' + @input
-- Big list of replaces
@input = replace(' in ','',@input)
@input = replace(' out ','',@input)
--- more replaces...
end
然后你需要一个表中的匹配列表,用“matchString”列调用这个“预定义”。
然后您可以使用以下命令检索匹配的行:
select p.matchString
from items i
join predefined p
on removeStrings(i.title) = p.matchString
一旦你有这些单独的部分工作,我提出一个新的问题,关于你可能用它们做什么特定的过程。
警告:不知道你有多少行或者你必须多久执行一次(每次用户保存一些东西?一次/天?),如果你明白我的意思,这不会完全是活泼的。因此,一旦您掌握了这些构建块,可能还会有一个后续问题,即如何以及何时去做。