Execute command
Executes a SQL command in a SQL Server database, and returns the number of rows affected by the query.
Note
This action does not return the result of the executed query. It simply returns the number of rows affected by the query.
Properties
Name | Type | Description |
---|---|---|
Title | Optional | The title or name of the command. |
Connection | Required | The SQL Server Connection. |
Dynamic connection | Optional | Use this option of you needs to use a connection from the Create Connection action. |
SQL expression and parameters | Required | The command to execute along with any parameters. |
Result variable name | Optional | The name of the variable that will contain the number of rows affected. |
Command timeout (sec) | Optional | The time limit for command execution before it times out. Default is 120 seconds. |
Description | Optional | Additional notes or comments about the action or configuration. |
Example: How to use parameters
To use parameters in the query, declare and assign variables in the SQL parameters
property.
Then use the parameters in the query.
UPDATE Users SET [Name] = @Name WHERE UserId = @UserId
Example: How to use Flow variables in the command expression
To use Flow variables in a SQL query as part of the expression, you need to first declare a variable as Global
and assign a value to the variable.
Then, enclose the variable in curly brackets like with the TableName
variable shown in the example below.
-- We have declared a Flow variable named TableName and assigned a value to it in a previous action.
UPDATE {TableName} SET [Name] = @Name WHERE UserId = @UserId
Returns
Int32 The number of rows affected.
Videos / Getting started
This section contains videos to help you get started quickly working with Azure SQL / SQL Server using Flow.
Dump CSV file from Azure Blob container to Azure SQL table
This video demonstrates how to import all records from a CSV file into an Azure SQL table.
In the demo, no data import options (such as data type conversion, number or date formatting) are specified, meaning the data is imported as raw text.