Azure SQL - Update
Overview
The Azure SQL - Update Snap executes a SQL update using the input document.
Keys from the document are used as the columns to update and their values are the updated value in the column.
- This is a Write-type Snap.
Works in Ultra Tasks
Supported Accounts
Prerequisites
- This Snap supports SQL Server 2008 or newer.
- A valid account with the required permissions.
Snap views
| Type | Description | Examples of upstream and downstream Snaps |
|---|---|---|
| Input |
This Snap has exactly one document input view. The input document is used to build the update query. Below is an example of how an input document is translated to a query. Input document:
Query:
|
|
| Output |
This Snap has at most one output view and produces documents in the view. The output fields of a single view are:
|
|
| Learn more about Error handling. | ||
Examples
- Basic Use Case (Azure SQL - Update): This example demonstrates how to update records in an Azure SQL table using an input document from an upstream Snap, with a static update condition.
- Typical Snap Configurations (Azure SQL - Update): This example demonstrates how to pass the Update Condition with or without expressions, using upstream document values or pipeline parameters.
Snap settings
| Field/Field set | Description |
|---|---|
Label
String |
Required. Specify a unique name for the Snap. Modify this to be more appropriate, especially if more than one of the same Snaps is in the pipeline. Default value: Azure SQL - Update |
Schema Name
String/Expression |
The name of the Azure SQL database that includes the table that will be
updated. If this is not specified then the Table Name should
be fully qualified with the database name. Optionally,the value can use double
quotation marks as an identifier. Note: The values can be passed using the pipeline
parameters but not the upstream parameter. Default value: N/A Example: SalesData |
Table Name
String/Expression |
Required. The table that will be updated. It can be
specified as the table name only if the Schema Name is
defined. Otherwise, it can be specified as a fully qualified name
"Database"."Table". Optionally, the value can use double quotation marks as an
identifier. Note: The values can be passed using the pipeline parameters but not the
upstream parameter. Default value: N/A Example:
|
Update Condition
String/Expression |
Specify the SQL WHERE clause of the update statement. You can define specific
values or columns to update (Set condition) in the upstream Snap, such as Mapper
Snap, and then use the WHERE clause to apply these conditions on the columns sourced
from the upstream Snap.
Sample Update SQL query:
Note: If the Update Condition field is left blank, the
condition is applied on all the records of the target table.
Note: In certain scenarios where you want to use specific data from the upstream
Snaps, and do not want to change that data in the Update Snap, then you need to
place the data in the
original structure of the input document.
We recommend that you use the following format for Update condition and input
data:
Note: Instead of building multiple Snaps with inter dependent DML queries, it is
recommended to use the Stored Procedure or the Multi Execute Snap. In a scenario
where the downstream Snap depends on the data processed on an Upstream Database
Bulk Load Snap, use the Script Snap to add delay for the data to be
available. Examples without using expressions:
Examples using expressions:
CAUTION: Using expressions that join strings together to create SQL
queries or conditions has a potential SQL injection risk and is hence unsafe.
Ensure that you understand all implications and risks involved before using
concatenation of strings with '=' Expression enabled.
Default value: N/A Example: EmpId = 12 |
Snap execution
Dropdown list |
Choose one of the three modes in
which the Snap executes. Available options are:
|
Troubleshooting
| Error | Cause | Resolution |
|---|---|---|
| Invalid column name 'username'. | A Snap with an update condition such as "Name = username"
fails because the string value specified in the update condition must be quoted with
single quotations. |
The proper update condition in this example is "Name =
'username'" with single quotations around the string value. |