Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save and execute a stored procedure in cosmos db through azure portal?

I tried to do this from the Script Explorer->Stored Procedure view, but when I use the button Save & Execute there, it only gives results in the following error message:

Failed to save the script

Database Account: myaccountname, Script: HelloWorld, Message: {"code":500,"body":"{\"message\":\"An error has occurred.\"}"}

And the textbox under Results is unchanged.

Below is a screenshot of how it looks in azure portal: Azure portal does not Save and Execute Stored Procedure

like image 394
Michael Rätzel Avatar asked Sep 06 '25 19:09

Michael Rätzel


1 Answers

@MichaelRätzel: I have just written a very simple CosmosDB Script and run it on Azure Portal.

function TestSample() {
    getContext().getResponse().setBody("Hello World");
}

And here is my result:

Azure Portal screenshot of succesful save

I got the same problem with you about the Failed to save the stored procedure. What I did to solve that problem is:

  1. Save the Stored Procedure first
  2. Left-click to the current SP on the left column
  3. Save & Execute the SP

I think this is a technical issue of Azure Portal. Try this and tell me the result.

like image 62
Minh Duc Lai Trung Avatar answered Sep 10 '25 04:09

Minh Duc Lai Trung