Pragmatic Works Nerd News

Azure Synapse Analytics: Stored Procedure Activity [Introduction to Synapse - Ep. 13]

Written by Mitchell Pearson | Sep 22, 2026

Azure Synapse Analytics provides a powerful platform for managing big data and running analytics at scale. In this video, Mitchell Pearson of Pragmatic Works explains how to incorporate stored procedure activities into an Azure Synapse Analytics pipeline. This feature can be used to streamline database operations, making it easier to automate data processing workflows. Below is a breakdown of the key points discussed in the video.

 

Getting Started: Prerequisites and Setup

To begin, Mitchell walks through the essential preliminary setup required before working with the stored procedure activity in Azure Synapse Analytics. He starts by creating a basic table within a database. This control table includes columns like:

  • FileName: The name of the file.
  • LastModifiedDate: The date when the file was last modified.
  • RecordInsertDate: The date when the record was inserted into the table.

Although the example uses a simple control table, in a production environment, this table would likely have additional columns such as status updates or validation checks, helping to manage ETL processes efficiently.

Connecting to Your Database

Once the database and table are set up, the next step is to establish a connection between Azure Synapse and the database. Mitchell uses Azure SQL Database for this example. The process includes creating a link service in Azure Synapse Analytics:

  • Go to the Manage hub and select Link services.
  • Create a new link service and choose Azure SQL Database.
  • Provide the connection details for your database, such as the server name, database name, and authentication credentials.

After successfully testing the connection, the link service is created, enabling Azure Synapse to interact with the database.

Setting Up the Pipeline

The stored procedure activity is part of a larger pipeline that processes files retrieved from an Azure Data Lake. In the previous video of the series, Mitchell demonstrated how the Get Metadata activity retrieves metadata from files in a folder. The stored procedure activity is introduced as a way to process this metadata and insert it into the database.

Here’s how the pipeline works:

  1. Get Metadata: Retrieves information about files in a folder.
  2. For Each: Iterates over each file and performs operations on them.
  3. Stored Procedure: Runs the stored procedure to insert metadata into the database.

Configuring the Stored Procedure Activity

In Azure Synapse Analytics, the stored procedure activity requires specifying a few key parameters, such as the file name, last modified date, and record insert date. However, since the metadata returned by the Get Metadata activity only includes file names and types, additional steps are needed to retrieve the last modified date.

To address this, Mitchell suggests using an additional Get Metadata activity inside the For Each loop to fetch the complete metadata for each file. This step will provide the last modified date, which can then be passed into the stored procedure.

Passing Parameters to the Stored Procedure

After the stored procedure is configured, the next step is to map the input parameters. This allows the stored procedure to dynamically receive values from the pipeline and insert them into the database. For each iteration of the For Each loop, the following parameters are passed:

  • FileName: The name of the file.
  • LastModifiedDate: The current date and time (since this information is not available in the metadata).
  • RecordInsertDate: The current date and time, as a placeholder for the actual insert date.

Mitchell uses the UTCNow() function to pass the current timestamp into both the LastModifiedDate and RecordInsertDate fields.

Running the Pipeline and Testing the Stored Procedure

Once everything is configured, Mitchell runs the pipeline in debug mode to test its functionality. By doing this, he can test the pipeline without publishing it, allowing for easy adjustments if necessary. During the debug session, the pipeline successfully inserts the file names and metadata into the table, as demonstrated by running a SQL query to check the table contents.

Conclusion: Key Takeaways

Mitchell wraps up the video by reinforcing the simplicity of using the stored procedure activity within an Azure Synapse Analytics pipeline. By following these steps, users can automate data ingestion processes and interact with databases in a seamless manner.

Here are the key takeaways:

  • Creating and configuring a control table: Set up a table in your database to hold metadata about files.
  • Establishing a link service: Create a link service to connect Azure Synapse Analytics to your database.
  • Using stored procedures in the pipeline: Pass metadata from the Get Metadata activity into a stored procedure to insert data into the database.
  • Testing with debug mode: Run the pipeline in debug mode to test the functionality without publishing changes.

For more information and to access the scripts used in the video, be sure to check the download link in the description. Pragmatic Works also offers comprehensive training on Azure Synapse Analytics and other data-related topics through live events, boot camps, and on-demand courses.

Don't forget to check out the Pragmatic Works' on-demand learning platform for more insightful content and training sessions on Azure Synapse and other Microsoft applications. Be sure to subscribe to the Pragmatic Works YouTube channel to stay up-to-date on the latest tips and tricks.