• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1093
  • 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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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