sql server - How to match patterns stored in SQL table -
i'm trying setup system can store phrases containing data placeholders in table can matched user's input string. example, today [date]
stored in column , potentially positively matched phrase today tuesday
. solution need fast. backend mssql , .net. ideas?
your matching options in sql like:
where columnname = 'today tuesday'
or
where columnname 'today %'
or
where columnname in ('today monday', 'today tuesday', 'today wednesday')
any of fast. use .net code build in list of potential placeholder replacements.
just beware of query like:
where columnname '% today'
this slower because leading wildcard makes impossible sql server use columnname index (if 1 exists), , instead perform table scan.
Comments
Post a Comment