SYMPTOM:
Users receive an error message when attempting to use the SUBSTRING function against a SQL Server Warehouse.
Consider the following metric definition that uses the SubStr function:

Formula: SubStr(Max(Country@DESC) {~} , 1, 4)
Level: Report
Condition: Nothing
Transformation: Nothing
However, when using this metric on a report, users receive the following error message:

Error: SQL Generation Complete
QueryEngine encountered error: Execute Query failed. Error type: Odbc error. Odbc operation attempted: SQLExecDirect. Argument data type numeric is invalid for argument 2 of substring function.
Error in Process method of Component: QueryEngineServer, Project Strategy Tutorial, Job 4040, Error Code= -2147212544.

CAUSE:
Notice in the SQL below (from the report above) that the precision of the SUBSTRING Metric has been changed from '1' to '1.0' and '4' to '4.0':
select a11."COUNTRY_ID" COUNTRY_ID,
a11."COUNTRY_NAME" CUST_COUNTRY_DESC,
SUBSTRING(a11."COUNTRY_NAME", 1.0, 4.0) WJXBFS1
from "LU_COUNTRY" "a11"
ACTION:

