Submitted by jimspoon on 2021/06/01 02:23

Is there a short form for a source bar filter like this:

[FileName] LIKE "*.jp*g" OR [FileName] LIKE "*.png" OR [FileName] LIKE "*.bmp"

Perhaps something like
[FileName] LIKE "*.jp*g"|"*.png"|"*.bmp"

or

[FileName] LIKE "*\.[(jp*g)(png)(bmp)]"

Comments

Hi Jim,

No, SQL does not support this

The best I could do is to process a custom operator and generate the corresponding SQL

e.g. [FileName] MATCH (*.jp*g|*.png|*.bmp)

 

Thanks, I don't mind the extra typing, I just wondered whether a shorter option was available.  Seems a bit odd that it wasn't included in SQL.  I was looking at the documentation for Transact-SQL and I noticed that the syntax did a limited use of square brackets as in regex, e.g LIKE "[bc]at" or LIKE "[a-f]xyz", only the bracketed part could only represent a single character.    

How do I ?