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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics SL (Archived)

Get output parameter from stored procedure in sl 2011

(0) ShareShare
ReportReport
Posted on by 580

Hi,

I have a custom stored procedure which get back an output paramter. Is there way to call it on the solomon and use the value of the output param.

I use the following code to call it with only the input parameters

SqlString = "exec xsp_CreateNew" + sparm(cType) + fparm(cBranch)

Call sql(C1,SqlString)

Thank you,

Mona

*This post is locked for comments

I have the same question (0)
  • Barry Flynn Profile Picture
    3,090 on at

    I almost had to do this a few years ago.

    The theory I was going to use was:-

    - Have a stored procedure with an output parameter

    - Have a second stored procedure which (a) runs the 1st proc, then (b) does a "select the_variable"

    - The SL code then does a conventional SQLFetch1 to run the 2nd proc.

    The idea is that the 2nd proc looks and behaves just like any other proc that SQLFetch1 deals with.

    That sounds to me like it should work, but I can't recall if I tried it (vefore the spec changed, and we did it a different way.)

    Barry

  • Blaine Bryant Profile Picture
    on at

    Mona,

    I can not think of anywhere in the standard code where this is done, and we have not tried anything custom like this before, so I would not be too hopeful that this will work. We will spend a little time on this tomorrow then we will get back to you.

  • Community Member Profile Picture
    on at

    I would set up a buffer to store the value. I would then set up the stored prcedure so that it returned the value using  sqlfetch1 into the buffer instead of calling sql.  you will have to turn no count on first thing in the procedure.

  • Barry Flynn Profile Picture
    3,090 on at

    Just a coment on the use of Set Nocount On.

    It often seems to be necessary these days to do a "Set NoCount On" at the start of triggers & procs.

    However can I just throw in a strange experience I had recently with new code in SL2011.

    It was a new proc, and I put "Set Nocount On" at the top.

    Then, in a new screen, I did an SQLFetch1 to run the proc and return the first row,

    And the SQLFetch1 kept failing.

    I eventually found that the SQLFetch1 worked correctly if I removed  that "set nocount on".

    Barry

  • MDawood Profile Picture
    580 on at

    Thank you BLAINE I really need this be done

    thank you,

    MDawood

  • MDawood Profile Picture
    580 on at

    I try to use SQLFetch1  once with "Set NoCount On" and other without it. both didn't work.

    the proc is working correctly but I can not get the output paramters.

    Any suggestion

  • MDawood Profile Picture
    580 on at

    I have made workaround to this, I found the the courser get hight value when I use this SP with output paramater. so I select the paramters at the end of the SP. and run the SP on SOlOMON using SqlFeatch1. it works corretly now. But I what is confusing me is how the courser working in SOLOMON

  • Blaine Bryant Profile Picture
    on at

    I am glad to see that you solved the issue. I just want to thank everyone for chiming in with their helpful tips.

  • Community Member Profile Picture
    on at

    Hi, 

    I am using a group fetch to return a small int from a stored procedure.  Any thoughts on how I can have the stored procedure return the small int and perform an insert on another table?

    Thanks in advance

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics SL (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans