Tableau – Error – “Invalid object name ‘#Tableau_8_2_Connect_CheckCreateTempTableCap’.”

Background

Playing around with Tableau and noticed an error recorded on our Microsoft SQL Server Database.

Error

Error Text


 Invalid object name '#Tableau_8_2_Connect_CheckCreateTempTableCap'.

Troubleshooting

SQL

Here is a modified version of the offending code :-


CREATE TABLE [#Tableau_8_2_Connect_CheckCreateTempTableCap] 

([COL] INTEGER

)

SELECT *

FROM [#Tableau_8_2_Connect_CheckCreateTempTableCap]

exec sp_describe_undeclared_parameters
N'INSERT INTO [#Tableau_8_2_Connect_CheckCreateTempTableCap] ([COL])
VALUES (@P1)'

Remediation

Outline

The issue is that sp_describe_undeclared_parameters does not work well with temporary tables.

Things work well when an actual table is used.

Please keep in that the pound sign # in the table name, [#Tableau_8_2_Connect_CheckCreateTempTableCap], means that the table is a temporarily table and it is created in temporary database, tempdb.

SQL


if object_id('[Tableau_8_2_Connect_CheckCreateTempTableCap]') is not null
begin

    drop table [Tableau_8_2_Connect_CheckCreateTempTableCap]

end

CREATE TABLE [Tableau_8_2_Connect_CheckCreateTempTableCap] (
	    [COL] INTEGER
)

SELECT *

FROM [Tableau_8_2_Connect_CheckCreateTempTableCap]

exec sp_describe_undeclared_parameters
          N'INSERT INTO [Tableau_8_2_Connect_CheckCreateTempTableCap] ([COL])
            VALUES (@P1)'

if object_id('[Tableau_8_2_Connect_CheckCreateTempTableCap]') is not null
begin

    drop table [Tableau_8_2_Connect_CheckCreateTempTableCap]

end

Output

parameters

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s