AnsweredAssumed Answered

arcpy SQL Query Issue - Possible Bug

Question asked by crombezk on Nov 21, 2017
Latest reply on Jan 30, 2018 by crombezk

We have a quality control script that rebuilds polygons from line work.

Our lines have comma separated letter tags that are used to identify what layer they represent when reconstructing the polygons.


So a sample value in our LineTags layer would look like this E,K,L,O,N,Q

We use a simple LIKE query statement to select the lines we need.

for example, "LineTags" LIKE '%E%', "LineTags" LIKE '%K%', etc...


however when doing a select by attribute, or make feature layer using the letter N...

"LineTags" LIKE '%N%' actually converts my query to "LineTags" LIKE '%0%' (see attachment).


This query works as expected in ArcMap.

But does NOT work using the arcpy module.


Does anyone know why this would happen?

Is there some sort of reserved word that would be causing this weirdness?


I know that N'value' in SQL represents a nvarchar.

But this is just strange.


I believe this is a bug.

Can anyone from ERSI please comment on this?