Best way to compare the end of a string, use RIGHT, LIKE or other?
问题 I need to compare the end of strings against a list of possible ending in a stored procedure. It will be called a lot and there are around 10-15 candidate endings. At this point a code-only solution is preferable to creating tables dedicated to this. Something that would be like: IF (ENDSWITH(@var, 'foo') OR ENDSWITH(@var, 'bar') OR ENDSWITH(@var, 'badger') OR ENDSWITH(@var, 'snake')) ( ) I'm looking for the best way in terms of speed, but also maintainability. Candidates that I know of are