Overview
This node, named "Rahsaz MSSQL," provides database operations for Microsoft SQL Server tables with optional integration to a PostgreSQL database for dependency resolution. It supports four main operations: Get, Create, Update, and Delete records in a specified table. The node is useful when you need to interact programmatically with MSSQL databases within an n8n workflow, such as inserting new records, updating existing ones, retrieving data with optional relational joins, or deleting entries.
A practical example includes creating a new record in a MSSQL table with specified fields, optionally generating a GUID for the new entry, or fetching a record by ID with related data from joined tables. The node also supports merging results and handling dependencies via PostgreSQL queries, which can be helpful in complex data synchronization scenarios between MSSQL and PostgreSQL systems.
Properties
Name | Meaning |
---|---|
Primary | Selects the primary database connection to use; options are "Click" or "PayamGostar". |
Table | The name of the target table in the MSSQL database where the operation will be performed. |
Guid? | Boolean flag indicating whether to generate and return a GUID for newly created records (Create). |
Merge? | Boolean flag indicating whether to merge the output data with input properties (all operations). |
Fields | A collection of column-value pairs specifying the data to insert or update in the table (Create/Update). Each field has: - Column: The column name in the table. - Value: The value to set for that column. |
Output
The node outputs JSON data representing the result of the database operation:
- For Create operations, it returns the inserted record's identifier under the
_ID_
key, either a GUID or an auto-generated identity value. - For Get operations, it returns the selected rows as JSON objects, including any joined relational data if configured.
- For Update and Delete operations, it returns the affected rows or confirmation of execution.
- If the "Merge?" property is enabled, the output JSON merges the original input properties with the database response under a
props
key. - The node does not output binary data.
Dependencies
- Requires valid credentials for two MSSQL connections ("Click" and "PayamGostar") and one PostgreSQL connection.
- Uses these credentials to connect to respective databases for executing queries.
- PostgreSQL is used specifically for resolving dependencies when fetching data.
- No environment variables are explicitly required beyond credential configuration in n8n.
Troubleshooting
- Empty Results on Get: If a "Get" operation returns no data, verify the provided ID exists in the specified table and that relations/dependencies are correctly configured.
- Query Errors: Malformed SQL queries may occur if field names or values are incorrect or missing. Ensure all required fields are provided and properly formatted.
- Credential Issues: Connection failures may happen if MSSQL or PostgreSQL credentials are invalid or lack necessary permissions.
- Dependency Resolution Delays: Dependency lookups in PostgreSQL include retry logic with delays; slow responses might cause timeouts or longer execution times.
- GUID Generation: When "Guid?" is enabled for create operations, ensure the database supports the NEWID() function or equivalent.