Using Not Equal to Wildcard in ArcMap Definition Query

arcgis-desktoparcmapdefinition-querysql

I'm attempting to use a definition query in order to display only a subset of data.
I have a large CAD drawing that I have imported into my map. I do not need many of the lines from the .dwg file to be shown. I noticed that most of the CAD lines I did not want to display shared similarly named attributes. Some lines were "Poly-Line-1", some were "Poly-Line-3", "Poly-Line-A", so on and so forth.
The query I attempted to use was the following:

"Attribute" <> 'Poly-Line-%' 

I was able to apply this statement, which seemed to indicate that it was syntactically correct. Unfortunately the file was not affected and each line was drawn as it had been before. I then tried:

"Attribute" <> 'Poly%' 

Again, it was treated as if the syntax was correct, but no change took place. As a workaround I ended up using a query similar to

"Attribute" NOT IN ('Poly-Line-1', 'Poly-Line-2', 'Poly-Line-3', etc) 

This was more efficient than something like

"Attribute" <> 'Poly-Line-1' AND "Attribute" <> 'Poly-Line-2' AND...

However it still took a while to list every thing I wanted.

I'm interested in any solutions that are more efficient than my final workaround and don't make use of ArcPy scripts. The problem I described is something I encounter at the workplace and I am mostly restricted to using the ArcMap GUI there.

Best Answer

You are using the wrong operator, It should work with :

"Attribute" NOT LIKE 'Poly-Line-%'

Related Question