Question : Modifying SQL Statement in AS400 Stored Procedure

I have a stored procedure in an AS400 database (V5R4) which I now need to modify.  The procedure pulls data from a CSV File and uses it to compare against a database and returns a selected group of columns from 1 table.  Now I need to add a Left outer join to another table as part of the return data.

Here is the original query:
'SELECT ' || COLS || ' FROM SCDATA.SCACCT as AC  RIGHT OUTER JOIN QTEMP.TEMPACCT as TMP ON AC.GACCT# = TMP.ACCT OR AC.GACCT# = TMP.ACC2' ;

I need to add a join to SCDATA.SCCLNT on SCACCT.GCLNT= SCCLNT.CCLNT to return the column SCCLNT.CLTGRP.  I have tried a number of approaches including adding the CLTGRP column at the call to this procedure, none of which have worked.  How can I combine these 3 tables to return  the correct results?

Answer : Modifying SQL Statement in AS400 Stored Procedure

Hi,

This is due to a change in the default setting for MARs.  It used to be  on by default and we changed it to off by default post RC1.  So just  change your connection string to add it back (add  MultipleActiveResultSets=True to connection string).

For more info:

http://www.netknowledgenow.com/blogs/onmaterialize/archive/2006/09/20/fixing-the-_2200_there-is-already-an-open-datareader-associated-with-this-command-which-must-be-closed-first_2e002200_-exception-in-entity-framework.aspx


Change it in the connection string, restart the applications and then check again through SSMS... this should be solving the issue.

Bye.
Random Solutions  
 
programming4us programming4us