

You will use the Servers node in the steps that follow however, you can use a Data Connection to you SQL Server server in the same way.Ģ. NOTE: It is not necessary to add a Data Connection to work with a SQL Server server because SQL Server servers are listed under the Servers node also.
#AZURE DATA STUDIO DEBUG STORED PROCEDURE CODE#
NET developer can use the Server Explorer to debug SQL Server stored procedures independently of any Visual Studio project, or the developer can step into the code of the stored procedure directly from managed code in a Visual Basic, Visual C#, or Visual J# project.ĭebug a stored procedure in standalone mode

This caused the stored procedure to fail.This step-by-step article explains two ways that you can debug SQL Server stored procedures and the necessary configuration settings and steps for each approach.Ī Visual Studio. The stored procedure was unable to create a new document (or access existing documents) in a partition key other than the one specified when the stored procedure is executed. Within the stored procedure, we tried to create a new document using the contosoairlines partition key. In this example, tried to execute the stored procedure within the context of the adventureworks partition key. Stored procedures are bound to a specific partition key. In the Result pane at the bottom of the tab, observe that the stored procedure execution has failed. Replace the contents of the stored procedure editor with the following JavaScript code: function greetCaller(name). In the stored procedure tab, locate the Stored Procedure Id field and enter the value: greetCaller. Within the InvestorCollection node, click the Documents link.Ĭlick the New Stored Procedure button at the top of the Data Explorer section.


In the Data Explorer section, expand the FinancialDatabase database node and then expand the InvestorCollection collection node. In the Azure Cosmos DB blade, locate and click the Data Explorer link on the left side of the blade. You will get started in this lab by authoring simple stored procedures that implement common server-side tasks such as adding one or more documents as part of a database transaction. You will use these values later in this lab. In the Keys pane, record the values in the CONNECTION STRING, URI and PRIMARY KEY fields. On the left side of the Azure Cosmos DB blade, locate the Settings section and click the Keys link. You will collect and store these credentials for use throughout the lab. NET SDKs both require credentials to connect to your Azure Cosmos DB account. Wait for the creation of the new database and collection to finish before moving on with this lab. In the Throughput field, enter the value 1000. In the Partition key field, enter the value /company. In the Collection id field, enter the value InvestorCollection. In the Database id field, select the Create new option and enter the value FinancialDatabase.Įnsure the Provision database throughput option is not selected. In the Add Collection popup, perform the following actions: In the Azure Cosmos DB blade, locate and click the Overview link on the left side of the blade.Īt the top of the Azure Cosmos DB blade, click the Add Collection button. In the cosmosgroup-lab blade, select the Azure Cosmos DB account you recently created. In the Resource groups blade, locate and select the cosmosgroup-lab Resource Group. On the left side of the portal, click the Resource groups link. You will now create a database and collection within your Azure Cosmos DB account. Create Azure Cosmos DB Database and Collection Setupīefore you start this lab, you will need to create an Azure Cosmos DB database and collection that you will use throughout the lab. You will explore features unique to JavaScript stored procedures such as throwing errors for transaction rollback, logging using the JavaScript console and implementing a continuation model within a bounded execution enviornment. In this lab, you will author and execute multiple stored procedures within your Azure Cosmos DB instance. Authoring Azure Cosmos DB Stored Procedures using JavaScript
