1 Reply Latest reply on Mar 28, 2013 9:48 AM by Robin Kennedy

    WITH statement in SQL connection

    tor.schoenmeyr

      I have written some SQL statements and tested them directly in SQL server - they work.

       

      When I try to use same statements in Tableau SQL connection I get an error message. I think I have isolated the issue to a WITH statement in the SQL code.

       

      Does Tableau not allow WITH statements or are there any special formating requirements...?  Any input would be appreciated.

       

      I have written something like:

       

      ;

      WITH X AS (

      SELECT

      partnumber

      FROM parttable

      )

      [...rest of query referencing to X]

       

        • 1. Re: WITH statement in SQL connection
          Robin Kennedy

          When you use custom SQL in the connection, Tableau wraps this into a subquery, and then queries it to get the results on the screen.

           

          I don't think you can use WITH within a subquery hence your errors.

           

          Are you able to write views in the database? Then you can use Tableau to connect to those.

          1 of 1 people found this helpful