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?

up vote 5 down vote accepted

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

contour % 50 = 0
  • 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 '16 at 5:20

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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