Microsoft SQL Server Microsoft SQL Server: Client

Summary

This module contains actions for running SQL Queries on a Microsoft SQL Server.

Before you Start

See Using Placeholders before using actions in this plugin.

Actions

mssql.client.

input_table

Display a list of records in a table, & allow the task operator to make a selection.

Minimum Plugin Version: 1.0.0

Input
  • text: the title of the table

  • records: a list of dictionaries to display in the table

  • minimum: The minimum number of acceptable selections (Optional)

  • maximum: The maximum number of acceptable selections (Optional)

Output

A list of dictionaries.

Tip
  • If neither a minimum or maximum is provided, the task operator will be able to submit 0 selections.

  • If minimum or maximum are provided, the operation will repeat until a valid number of selections is made.

Example

Getting all records from a users table, displaying it and waiting for a single selection:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
- mssql.client.select:
    query: SELECT * FROM users
  load:
    mssql: mssql_secrets
  save: users

- mssql.client.output_table:
    text: Select a user
    minimum: 1
    maximum: 1
  load:
    records: users

mssql.client.

insert

Run an INSERT SQL query.

Minimum Plugin Version: 1.0.0

Input
  • mssql: an MSSQLServer dictionary

  • query: the SQL Query to run

  • placeholders: Optional Placeholders to format in to the SQL query before it is executed.

Output

Nothing is outputted by this action.

Example
1
2
3
4
5
6
7
- mssql.client.insert:
    query: INSERT INTO users(username, name) VALUES(?, ?)
    placeholders:
      - "{{ username }}"
      - "{{ name }}"
  load:
    mssql: mssql_secrets

mssql.client.

output_table

Display a list of records in a table.

Minimum Plugin Version: 1.0.0

Input
  • text: the title of the table

  • groups: a single or list of dictionaries

Output

Nothing is outputted by this action.

Example

Getting all records from a users table and displaying it:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
- mssql.client.select:
    query: SELECT * FROM users
  load:
    mssql: mssql_secrets
  save: users

- mssql.client.output_table:
    text: All Users
  load:
    records: users

mssql.client.

select

Run a SELECT SQL query.

Minimum Plugin Version: 1.0.0

Input
  • mssql: an MSSQLServer dictionary

  • query: the SQL Query to run

  • placeholders: Optional Placeholders to format in to the SQL query before it is executed.

Output

A list of dictionaries.

Tip

For more information, regarding the output from this action, see Running Select Queries.

Example
1
2
3
4
5
6
7
- mssql.client.select:
    query: SELECT * FROM users WHERE name LIKE '%?%'
    placeholders:
      - "{{ name }}"
  load:
    mssql: mssql_secrets
  save: users

mssql.client.

update

Run an UPDATE SQL query.

Minimum Plugin Version: 1.0.0

Input
  • mssql: an MSSQLServer dictionary

  • query: the SQL Query to run

  • placeholders: Optional Placeholders to format in to the SQL query before it is executed.

Output

Nothing is outputted by this action.

Example
1
2
3
4
5
6
7
- mssql.client.update:
    query: UPDATE users SET surname = ? WHERE id = ?
    placeholders:
      - "{{ surname }}"
      - "{{ user_id }}"
  load:
    mssql: mssql_secrets