Tableau's custom SQL option can only contain a standalone SELECT statement. No declarations or temporary tables can be included.
- It is possible to utilize a stored procedure in the Custom SQL per the information provided in the stored procedures Knowledge Base article: Working with Stored Procedures and Functions
- Please note that Custom SQL and stored procedure use in Tableau may result in decreased performance as it is necessary to wrap the custom SQL query with a select statement so the functional aspects of the software can be added as needed (for filters, groups, etc.). For more information, please see: Connecting Through Custom SQL Causes Slow Performance