Skip to main content

Execute SQL in SQL Server DB

Execute SQL in a SQL Server DB. The SQL may request an email to be sent and/or the Task to fail.

Category: Execute Query on Database

How it works

Execute SQL against a SQL Server database

To use this activity within the API, use an ActivityCode of EXEC-SQLSERVER.

Available Connections​

TargetConnection:

Example JSON​

An example of what the Task Config would look like for a task using this activity. Some of these variables would be set at the group level to avoid duplication between tasks.

{
"TargetConnection": "",
"QueryToExecute": ""
}

Variable Reference​

The following variables are supported:

  • EmailMessage (Optional) - The body of the email.

  • EmailRecipients (Optional) - The semi-colon separated list of recipients of the email.

  • EmailSubject (Optional) - The subject of the email.

  • EmailTemplate (Optional) - The template to be used to format the email.

  • IsFederated (Optional) - Makes task available to other Insight Factories within this organisation.

  • Links (Optional)

  • MaximumNumberOfAttemptsAllowed (Optional) - The total number of times the running of this Task can be attempted.

  • MaximumRunTimeHours (Optional) - The maximum number of hours a task run is expected to take. If a run exceeds this duration it will be flagged as stuck.

  • MinutesToWaitBeforeNextAttempt (Optional) - If a Task run fails, the number of minutes to wait before re-attempting the Task.

  • QueryToExecute (Required) - Query to execute against target database. Can be any valid SQL statement.

  • TargetConnection (Required) - Target connection to use.