Call SP from AX.

HI All,

I am developing a solution which will execute the SP which will be called from AX.

The utility in AX fills the AX table which will contain thousands of records and the SP being called will move the data from AX Table to non AX table.

I am using the below piece of code to execute the SP from AX:

LoginProperty loginProperty = new LoginProperty();
ODBCConnection odbc;
Statement stmt;
ResultSet res;
str parameters = ‘’;
int var = 0;
SqlStatementExecutePermission perm;
loginProperty.setServer(“DB Server”);
loginProperty.setDatabase(“AX database”);

odbc = new ODBCConnection(loginProperty);
parameters = ‘execute AVA_TransferStagingDataToXWBUDGET’;
perm = new SqlStatementExecutePermission(parameters);
stmt = odbc.createStatement();

The problem I am facing here is that SP is getting executed from AX within seconds and updates/moves only few records from AX table to non AX table. Not all the records from AX table are updated to Non Ax table.

When I go back to database and execute the same SP its working fine and takes more time to move my staging data from AX table to non Ax table.

Could someone please suggest as what is going wrong when I am executing the SP from AX. Why the entire data from AX table is not getting moved to other non ax table .

Thanks in Advance,