6

I use the MOD expression quite frequently in my definition queries in ESRI to extract fields that are divisible by a specific vale

for example: MOD( [contour], 50) = 0 OR contour = MOD(0, 50)

However I have just moved my feature class from an ESRI file geodatabase onto an ESRI SQL Server and by doing this is appears to make the MOD expression redundant.

The error that comes up when i enter in the normal MOD expression is as follows

"There was an error with the expression. Underlying DBMS error [[Microsoft][SQL Server Native Client 11.0][SQL Server]'MOD' is not a recognized built-in function name."

Has anyone experienced this and if so, were you able to find another expression that does the same thing as the MOD expression?

1 Answer 1

9

The mod keyword is not recognised by SQL Server. For modulo function, you'll need to reformat the expression like so:

contour % 50 = 0
1
  • Beat me to it. Worth noting is that while the % operator works on feature classes within the SDE, it will not work on feature classes within a file geodatabase. You need to use the MOD function outside of the SDE. Unsure of whether this applies to shapefiles also.
    – nwduncan
    Oct 5, 2016 at 5:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.