Thursday, 19 February 2015

arcgis desktop - Using the MOD expression on an SQL Feature Class is not possible?


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?




Answer



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


contour % 50 = 0

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...