2 of 2 people found this helpful
I'm assuming you're using a SQL Server temp table (#) as opposed to a table variable (@). If so, SQL Server should automatically clean up temp tables after a user session ends. Here's a good blog on this topic: Actually you can use variables, CTEs and other fancy SQL with Tableau after all – Dabbling with Data
That's interesting - I wonder what a "user session" is considered. If it's a live connection then I would assume the table would drop when Tableau returns the data and then re-run the initial SQL upon refreshing?
A user session would be the connection to the database. But I think you're right that it would need to constantly drop the temp table and recreate it for your custom SQL to work on a live connection.