Using LIKE in SQL Server to identify strings -
i writing program performs operations on database of football matches , data. 1 of issues have source data not have consistent naming of each team. leyton orient appear l orient. of time team listed l orient. need find closest match team name when not appear in database team name list appears in data importing. in database have table 'team' data sample follows:
teamid teamname teamlocation 1 arsenal england 2 aston villa england 3 l orient england
if name 'leyton orient' appears in data being imported need match l orient , teamid 3. question is, can use function achieve in case team name longer name in database? have figured out if had 'leyton orient' in table , importing 'l orient' locate correct entry with:
select teamname team teamname '%l%orient%';
but can other way around? also, have example manchester united , want import man utd. find putting % sign between every character this:
select teamname team teamname '%m%a%n%u%t%d%';
but there better way?
finally, , might better put in question, not have search correct team when way team named repeated, i.e. store alternative spellings/aliases teams in order find correct team entry quickly. can advise on how might approach this? thanks
the solution looking full text search
, it'll require dba create full text index, however, once there can perform more powerful searches character pattern matching.
as others have suggested, have alias
table, contains possible forms of team name , reference that. depending on how search working, may path of least resistance.
Comments
Post a Comment