Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL error running Python

Status
Not open for further replies.

PeteJohnston

Programmer
Nov 6, 2002
291
GB
I'm trying to write some code to use Python to create a real Excel 2010 file from one of the iSeries files. I've created a command that accepts an SQL statement and an output location as parameters. It works perfectly when only one file is involved, for example listing all transactions for a customer. When I then try to do a join to the Customer file it fails, giving me SQLState 42703, Error code -206 saying that a column is not found. It finds the field name when there is no JOIN. It finds the same field name when I cut & paste the SQL into STRSQL where it runs correctly.

Code:
SELECT CUST.CUCSNO, CUST.CUCSNM, CUST.CUAMCD, CURX.CRAN04, CUST.CUAN03 
FROM RTHAFILE.CUST INNER JOIN RTHAFILE.CURX ON CUST.CUCSNO = CURX.CRCSNO

Has anyone come across this before?

PeteJ
(Contract Code-monkey)

It's amazing how many ways there are to skin a cat
(apologies to the veggies)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top