StoredProcedure class 
Åtgärder för att läsa, ersätta, ta bort eller köra en specifik, befintlig lagrad procedur med ID.
För åtgärder för att skapa, läsa alla eller fråga lagrade procedurer,
Egenskaper
| container | |
| id | |
| url | Returnerar en referens-URL till resursen. Används för länkning i Behörigheter.  | 
Metoder
| delete(Request | 
	Ta bort angiven StoredProcedure. Exempel 
 | 
| execute<T>(Partition | 
	Kör den angivna StoredProcedure. Den angivna typen T tillämpas inte av klienten. Kontrollera att svaret från den lagrade proceduren matchar den typ, T, som du anger. Exempel 
 | 
| read(Request | 
	Läs StoredProcedureDefinition för den angivna StoredProcedure. Exempel 
 | 
| replace(Stored | 
	Ersätt den angivna StoredProcedure- med angiven StoredProcedureDefinition. Exempel 
 | 
Egenskapsinformation
container
id
id: string
				Egenskapsvärde
string
url
Returnerar en referens-URL till resursen. Används för länkning i Behörigheter.
string url
				Egenskapsvärde
string
Metodinformation
		delete(RequestOptions)
	 
	Ta bort angiven StoredProcedure.
Exempel
import { CosmosClient } from "@azure/cosmos";
const endpoint = "https://your-account.documents.azure.com";
const key = "<database account masterkey>";
const client = new CosmosClient({ endpoint, key });
const { database } = await client.databases.createIfNotExists({ id: "Test Database" });
const { container } = await database.containers.createIfNotExists({ id: "Test Container" });
await container.scripts.storedProcedure("<sproc-id>").delete();
				function delete(options?: RequestOptions): Promise<StoredProcedureResponse>
				Parametrar
- options
 - RequestOptions
 
Returer
Promise<StoredProcedureResponse>
		execute<T>(PartitionKey, any[], RequestOptions)
	  
	Kör den angivna StoredProcedure.
Den angivna typen T tillämpas inte av klienten. Kontrollera att svaret från den lagrade proceduren matchar den typ, T, som du anger.
Exempel
import { CosmosClient } from "@azure/cosmos";
const endpoint = "https://your-account.documents.azure.com";
const key = "<database account masterkey>";
const client = new CosmosClient({ endpoint, key });
const { database } = await client.databases.createIfNotExists({ id: "Test Database" });
const { container } = await database.containers.createIfNotExists({ id: "Test Container" });
const { resource: result } = await container.scripts
  .storedProcedure("<sproc-id>")
  .execute(undefined);
				function execute<T>(partitionKey: PartitionKey, params?: any[], options?: RequestOptions): Promise<ResourceResponse<T>>
				Parametrar
- partitionKey
 - PartitionKey
 
Partitionsnyckeln som ska användas när den lagrade proceduren körs
- params
 - 
				
any[]
 
Matris med parametrar som ska skickas som argument till den angivna StoredProcedure.
- options
 - RequestOptions
 
Ytterligare alternativ, till exempel partitionsnyckeln för att anropa StoredProcedure på. *
Returer
Promise<ResourceResponse<T>>
		read(RequestOptions)
	 
	Läs StoredProcedureDefinition för den angivna StoredProcedure.
Exempel
import { CosmosClient } from "@azure/cosmos";
const endpoint = "https://your-account.documents.azure.com";
const key = "<database account masterkey>";
const client = new CosmosClient({ endpoint, key });
const { database } = await client.databases.createIfNotExists({ id: "Test Database" });
const { container } = await database.containers.createIfNotExists({ id: "Test Container" });
const { resource: sproc } = await container.scripts.storedProcedure("<sproc-id>").read();
				function read(options?: RequestOptions): Promise<StoredProcedureResponse>
				Parametrar
- options
 - RequestOptions
 
Returer
Promise<StoredProcedureResponse>
		replace(StoredProcedureDefinition, RequestOptions)
	   
	Ersätt den angivna StoredProcedure- med angiven StoredProcedureDefinition.
Exempel
import { CosmosClient, StoredProcedureDefinition } from "@azure/cosmos";
const endpoint = "https://your-account.documents.azure.com";
const key = "<database account masterkey>";
const client = new CosmosClient({ endpoint, key });
const { database } = await client.databases.createIfNotExists({ id: "Test Database" });
const { container } = await database.containers.createIfNotExists({ id: "Test Container" });
const sprocDefinition: StoredProcedureDefinition = {
  id: "sample sproc",
  body: "function () { const x = 10; }",
};
const { resource: sproc } = await container.scripts.storedProcedures.create(sprocDefinition);
sproc.body = function () {
  const x = 20;
  console.log(x);
};
const { resource: replacedSproc } = await container.scripts
  .storedProcedure(sproc.id)
  .replace(sproc);
				function replace(body: StoredProcedureDefinition, options?: RequestOptions): Promise<StoredProcedureResponse>
				Parametrar
Den angivna StoredProcedureDefinition för att ersätta den befintliga definitionen.
- options
 - RequestOptions
 
Returer
Promise<StoredProcedureResponse>