SQL Server
SQL Server works with the tables of your Microsoft SQL Server database from a flow: it reads rows, adds new ones, changes or deletes existing ones, runs SQL queries and describes the database structure.
When to use it
- Your ERP or CRM keeps its data in SQL Server and you want to query it from a flow.
- Giving an agent access to look up customers, orders or stock.
- Updating a specific record from its key.
Configuration
The Operation field decides what the component does and which fields appear: Insert (default), Get, Update, Delete, Custom Query, Get Schema (lists the tables or a table’s columns) and DatabaseInfo (describes the database). Once you pick the credential, Schema and Table Name fill with your database’s.
You need a SQL Server credential with the server, port, user, password and database. See Credentials.
| Field | What it does |
|---|---|
| Credential (required) | The SQL Server credential with the connection details. |
| Operation (required) | What the component does. |
| Schema (required) | The schema that holds the table. |
| Table Name (required) | The table to work on. |
| Use Filters | Turn it on to choose which rows are read, changed or deleted. When on, Selection Mode appears: By Primary Key (by key, with Primary Key Value) or By Filters (by conditions). |
| Primary Key Value | The key value of the row to change or delete. |
| Select Filter Type | How you write the conditions: String (default), in Filter String, or Build Manually, with Number Of Filters To Use and one field per condition. |
| Filter String | The conditions, for example age > 25 AND city = 'Madrid'. Empty with Get, every row is returned. |
| Custom Query (required) | With Custom Query. The SQL query to run. |
| Detail Level | With Get Schema. Tables (default) returns the table names; Columns, the column details of the table chosen in Table. |
Advanced options
| Field | What it does |
|---|---|
| Limit | The maximum number of rows returned. Default: 10. |
| Return All | Returns every row regardless of Limit. Off by default. |
Output
The Data output holds the operation’s result: the rows read or confirmation of what changed. The Database Info output holds the database description.
In tool mode, an agent can use the component to look up or change data by itself. See Tool Mode.
Example
A distributor wants its assistant to check stock in its ERP.
- Add SQL Server with the SQL Server credential.
- Choose
Get, thedboschema and theitemstable. - Put it in tool mode so the agent writes the condition in Filter String.
Good practices
- Use a read-only credential if the component will only look things up.
Related components
- MySQL and Postgres SQL: the same for other databases.