KNOWLEDGE BASE

Custom SQL Query Using the operator "~*" Returns NULL Results


Published: 29 Dec 2016
Last Modified Date: 10 Apr 2017

Issue

When connecting with a custom SQL that uses the operator ~*, the query is returns NULL results. For example, the following query:

SELECT * FROM "Table Name"
WHERE "Table Name"."Field Name" ~* <Parameters.Parameter Name>


will return NULL results if the user types multiple words into [Parameter Name].

Environment

  • Tableau Desktop
  • Custom SQL

Resolution

Option 1

Modify the custom SQL query to use only ANSI standard operators

Option 2

Write a calculated field that uses RAWSQL pass-through functions to use as a data source filter. RAWSQL pass-through functions allow SQL queries to be passed to the database without being modified by Tableau Desktop.

Cause

  • Tableau Desktop modifies custom SQL queries before sending them to the database.
  • Custom SQL is also wrapped to retrieve metadata, and to ensure Tableau can add analytical clauses such as HAVING, ORDER BY, WHERE, etc…, without having to determine how to merge this into the existing syntax expressed by a user's Custom SQL.
Did this article resolve the issue?