An Innovator SQL Procedure Return "Cannot Find Table 0" error message

Community,

I have written a SQL Query, Stored Procedure, to Order an xClassTree so that the top level xClasses are in the alphabetical order.

If I run the query just as a SQL query, in SSMS, it works great.

If i run the query as a Stored Procedure in SSMS, created using the innovator SQL itemtype, it works great.

If I try and run it from a javascript method it does not work and generates a SOAP message.

The javascript code uses the following to trigger the run.

In the debugger see the following in resetXClassTopLevelOrder Item, under DOM:XMLDocument, after .apply()

I have tried reorganizing the SQL code and no luck.

Thanks for the help and/or insights.

Scott