• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1154
  • Last Modified:

What could this sql error message mean? Error: Column name appears more than once in the result column list

I have added a column to several tables, and I populate the column using a couple of stored procedures in a huge import process. I am getting this error returned when I run the main stored procedure. I can run all of my individual stored procedures which are called once for each table where the column is located. I don't get this error. Can anyone give me an idea on what the error means. I am sorry I can't be more specific but the process is very long and complicated.


Sue
0
Sue_W
Asked:
Sue_W
2 Solutions
 
ivanovnCommented:
You have multiple tables that contain a column with the same name and there exists a query that is pulling the data from those tables therefore getting confused in column names.

For example I believe the following scenario would generate that error:

"table1" has two columns named "id" and "name"
"table2" has two columns named "id" and "description"

If you do:
SELECT id FROM table1, table2 WHERE name=description
it might throw that error. I haven't tested that, but I think that is the case. Check your added column name and see if it causes this kind of case in your code.
0
 
SjoerdVerweijCommented:
You probably have a select with a * in there. Specify the columns.

E.g.

Instead of

Select T1.*, T2.*
From ...

do

Select T1.Col1, T1.Col2, T1.Col3...

This happens because T1 and T2 have a column with the same name.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now