web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

[AX2009]: Call a stored procedure

(0) ShareShare
ReportReport
Posted on by 197
Hello together,
 
I'm currently facing a problem in MS Dynamics AX 2009. Im trying to call a stored procedure via x++ code with the following code:
 
 
The execution is successful (no errors) but the content of the stored procedure is not executed and the effect / result could not be seen in the DB.
 
If i run the stored procedure directly from the SQL Management Studio with the identical SQL Statement /EXEC [MY_ITEM]..../ everything is executed correctly.
 
Any idea why the code / the class is executed without errrors but no effect in the DB?
 
Thanks for any hint
Sebastian
I have the same question (0)
  • Verified answer
    Basti Aurand Profile Picture
    197 on at
    [AX2009]: Call a stored procedure
    After a bit of trial and error I came out with a solution. My problem was a combination of two issues:
     
    1. You need to set the correct access rights on the stored procedure after creating it in the sql management studio (you could copy the rights from the AX standard SP "dbo.CREATESERVERSESSIONS")
    2. After changing the executeQuery to executeUpdate the SP is executed correctly:
     
  • Basti Aurand Profile Picture
    197 on at
    [AX2009]: Call a stored procedure
    Hi Martin,
     
    thanks for your response. The stored procedure copies values from AX tables to an external DB, therefore I did not check it in x++ / AX 2009. I checked the result (copied values are available or not) directly in the external database tables via the SQL management studio and I did not get any records / values when executing via x++. I extended the code a bit to get some more information:
     
     
    For me everything seems fine apart from the fact that nothing is done in the SQL DB.
     
    Any other ideas what I could try?
    Sebastian
  • Martin Dráb Profile Picture
    235,804 Most Valuable Professional on at
    [AX2009]: Call a stored procedure
    You seem to be saying that executeQuery() runs without error and it returns an empty result, but your code checks neither of that.
     
    Please look at what you get from executeQuery() and then call statement.getLastError()  and check its return value too.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Sohaib Cheema Profile Picture

Sohaib Cheema 665 User Group Leader

#2
Martin Dráb Profile Picture

Martin Dráb 595 Most Valuable Professional

#3
Yng Lih Profile Picture

Yng Lih 558

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans