KNOWLEDGE BASE

Error '"Custom SQL Query.X" is not valid in the context where it is used'


Published: 28 Sep 2021
Last Modified Date: 28 Sep 2021

Issue

When using a custom SQL query, clicking 'Update Now' in the data grid area on the Data Source page may result in the following error:

[IBM][CLI Driver][DB2] SQL0206N "Custom SQL Query.X" is not valid in the context where it is used. SQLSTATE=42703
 

Note: X is an integer, and would vary depending on the custom SQL query used.

Environment

  • Tableau Desktop
  • Window
  • DB2

Resolution

  1. Refer to the value of X in the error message. This indicates the column number of the field with the problematic function. For example, if X is 9, the function used in the ninth field should be modified.
  2. Modify the custom SQL query. For example, the UPPER function can be omitted in the custom SQL query, and then implemented using a calculated field in Tableau.

Cause

An incompatible function (such as UPPER) is used in the custom SQL query.
Did this article resolve the issue?