Overview
This node provides CRUD (Create, Read, Update, Delete) operations on a Microsoft SQL Server database table, with support for two different primary data sources ("Click" and "PayamGostar"). It allows users to specify the target table and perform operations by ID or with custom fields. The node can also handle relational joins and dependencies when retrieving data.
Common scenarios include:
- Deleting a specific record from a database table by its ID.
- Managing records in MSSQL tables where integration with related tables or external dependencies is required.
- Using the node in workflows that need to synchronize or manipulate data between MSSQL and PostgreSQL databases.
Example use case:
- A user wants to delete a customer record from the "Customers" table in the MSSQL database identified by a unique ID.
Properties
Name | Meaning |
---|---|
Primary | Selects the primary data source: either "Click" or "PayamGostar". |
Table | The name of the database table on which the operation will be performed. |
ID | The unique identifier of the record to get, update, or delete. Required for these actions. |
Merge? | Boolean flag indicating whether to merge additional properties into the output JSON. |
Output
The node outputs an array of JSON objects representing the result of the executed operation:
- For Delete operation: The output contains the result of the deletion query, typically an empty or confirmation response.
- For other operations (Get, Create, Update), the output includes the affected record(s) with their fields.
- If
merge
is true, the original input properties are merged into the output JSON under aprops
key. - The output does not include binary data.
Dependencies
- Requires credentials for connecting to MSSQL databases corresponding to the selected "Primary" option.
- Also requires credentials for a PostgreSQL database used for resolving dependencies during "get" operations.
- The node depends on helper modules for executing MSSQL queries and initializing PostgreSQL connections.
- Proper configuration of these credentials and network access to the databases is necessary.
Troubleshooting
- Empty results on Get/Delete: Ensure the provided ID exists in the specified table.
- Query errors: Verify the table name and column names are correct and accessible by the connected user.
- Dependency resolution delays: When dependencies are forced to resolve but not found immediately, the node waits and retries after a delay; ensure dependent data consistency.
- Credential issues: Confirm that the API keys or authentication tokens for MSSQL and PostgreSQL are valid and have sufficient permissions.
- Merge flag confusion: If unexpected data appears in output, check if the "Merge?" property is set correctly.
Links and References
- Microsoft SQL Server Documentation
- PostgreSQL Documentation
- n8n documentation on Creating Custom Nodes