I Upgraded from server 10.4 to 10.8.1 and was using a Query on a service to fetch data to another system one of the column in a Double (all of it's values are integers) before the upgrade the query returned them as integers with out decimal (1)but after the upgrade it returns with decimal(1.0) which is causing problem.
at first I thought that maybe we change the data type but that's a change in schema which if my knowledge is correct will need for republishing all the services that are using the layer with that filed which definitely didn't happened.
So is there a way to return the field as INT using the REST query through the service link cause I think as per the documentation it can't be done with SQL Expression because OutFieldSqlExpression is only supported on ArcGIS Online currently.
I don't think you can from the query itself.
What's your process look like that you're using this query for? It should be simple enough to take the resulting FeatureSet and cast the data type separately from the query
We have scripts that submit a REST query via Python and read the results into a pandas dataframe, and then we can use dataframe['column'].astype('int') to convert it. We work with a few data sources that we do not have control over the schema for, so it's a useful tool for us.