Link to home
Start Free TrialLog in
Avatar of ibgadmin
ibgadminFlag for United States of America

asked on

SQL select into query

Can someone help with what is wrong with my syntax below on my SQL statement?  I get  Error: Column names in each table must be unique. Column name 'CUSTEDP' in table 'IBGTEMP_ACCTCOMM_BACKUP' is specified more than once. (State:S0021, Native Code: A91) I'm trying to backup select records from ACCTCOMMENTS table into a backup table called IBGTEMP_ACCTCOMM_BACKUP.

SELECT * INTO IBGTEMP_ACCTCOMM_BACKUP
FROM ACCTCOMMENTS ACMT
INNER JOIN STANDINGHEADER STHD
ON ACMT.CUSTEDP = STHD.CUSTEDP
WHERE STHD.CUSTEDP=ACMT.CUSTEDP AND ACMT.TYPE='SO'
Avatar of Leo Torres
Leo Torres
Flag of United States of America image

Looks like in the columns selected you have columns that have the same name. I would Explicitly write out all the columns needed to be put on to the new into Table.

You can have the new table have columns with the same names I would name them something else when you explicitly write them
ASKER CERTIFIED SOLUTION
Avatar of Leo Torres
Leo Torres
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ibgadmin

ASKER

That did it Leo, thanks so much