Try breaking the SQL statement into two parts. One statement to create the table and another to insert the data. -----Original Message----- From: midrange-l-bounces+bill.erhardt=bdhhi.com@xxxxxxxxxxxx [mailto:midrange-l-bounces+bill.erhardt=bdhhi.com@xxxxxxxxxxxx] On Behalf Of Tim Ellifritz Sent: Friday, October 08, 2004 3:06 PM To: midrange-l@xxxxxxxxxxxx Subject: RUNSQLSTM I'm a greenhorn, Trying to use SQL statements in CL program to update a temp file for a report. Using CSSTKN3 to run SQL statements in CSSTKN4... CSSTKN3 - Source 1.00 PGM 2.00 RUNSQLSTM SRCFILE(R36MODS/QCLSRC) SRCMBR(CSSTKN4) + 3.00 COMMIT(*NONE) 4.00 ENDPGM CSSTKN4 - Source 01.00 CREATE TABLE QTEMP/TBLSTKN (ITEM CHAR (20 ) NOT NULL WITH DEFAULT, 02.00 QTY DEC (10 , 4) NOT NULL WITH DEFAULT) 03.00 INSERT INTO QTEMP/TBLSTKN SELECT IJITEM , SUM(IJQTY) FROM CSSTKN 04.00 GROUP BY IJITEM What looks wrong? - Table gets created but having problem with insert I think. DUMP attached... Tim Ellifritz Creative Stage Lighting Co., Inc. 149 Rt. 28N North Creek, NY 12853 T 518-251-3302 X 218 F 518-251-2908 ----------------------------------------- This message was scanned for viruses.
This mailing list archive is Copyright 1997-2013 by MIDRANGE dot COM and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact