3 Replies Latest reply on Sep 12, 2018 11:14 AM by John Hobby

    Stored Procedure Returns Duplicate Column Names

    Claire Kim

      Hi Tableau Community,

       

      I had some issue with connecting to a stored procedure on MS SQL Server and was wondering if anyone from the community could give me a hint.

       

      Below are the parameters for this sp and I was getting the error message on the right for all the input values I have attempted. When executing the sp in SQL Server, I get two of the same tables (I anticipate Tableau to ignore the second table based on the desktop help instructions), but there doesn't seem to be duplicates in the column names.

       

       

      My question is: What are some common reasons that may lead to the error message shown above? I may be able to attach the stored procedure here if it's needed, I just want some insight of what to look out for when connecting to MS sql stored procedures, given I haven't seen similar error messages in other forum posts.

       

      Thanks a lot in advance!

       

      Best,
      Claire

        • 1. Re: Stored Procedure Returns Duplicate Column Names
          Ritesh Bisht

          Hello Claire,

           

          Have seen a similar post here Stored Procedure - simple return values, but data errors no matter what

           

          "The "[dbo].[spPromptTimesDetail]" stored procedure returned no results. The fields don't have column names, or the data in the fields is not a supported data type. Unable to connect to the server "trabajo". Check that the server is running and that you have access privileges to the requested database."

           

          This error typically indicates an issue connecting to the SQL server itself.

          Do you have the latest drivers?  Driver Download | Tableau Software  and are you able to connect to this database and tables with no problem?

           

          What version of Tableau is in use as well?

           

          Ritesh

          • 2. Re: Stored Procedure Returns Duplicate Column Names
            Claire Kim

            Hi Ritesh,

             

            Thanks a lot for your reply!

             

            I have seen the post you mentioned before posting and thought my case might be a bit different. I am using 2018.1.3 and SQL Server 2016. Prior to attempting the stored procedure connection, I have requested permission to execute sp in the DB for both myself and the Tableau server. I was able to use other stored procedures, but this one is having "duplicate column name" issue specifically.

             

            Not sure if any of the info is helpful. By any chance am I missing something obvious here? Thanks again for your time and help!

             

            Claire

            • 3. Re: Stored Procedure Returns Duplicate Column Names
              John Hobby

              Howdy,

               

              If you have access to the script for the sp, you'll need to update it to make sure all columns are defined with unique names.  I've run into this a few times

              select * from table a inner join table b on a.key = b.key

              this will kick out an error that there are duplicate fields.  meaning, a.key and b.key are both named 'key'.

               

              the fix is to name each field

              select a.key as a_key, b.key as b_key from table a inner join table b on a.key = b.key

               

              If you don't have access to change the sp - you'll need to have your dba make sure to name the columns in your data source individually unique.

               

              John