Rahsaz MSSQL icon

Rahsaz MSSQL

RahsazMSSQL Methods

Overview

This node, named "Rahsaz MSSQL," provides a unified interface to perform CRUD (Create, Read, Update, Delete) operations on Microsoft SQL Server databases with additional support for related data and dependencies stored in a PostgreSQL database. It supports two primary connection types ("Click" and "PayamGostar") and allows querying tables dynamically based on user input.

Common scenarios where this node is beneficial include:

  • Integrating legacy or custom MSSQL databases into n8n workflows.
  • Performing complex queries involving relational joins and dependencies across MSSQL and PostgreSQL.
  • Automating database record management such as inserting new records, updating existing ones, retrieving detailed joined data, or deleting records.
  • Synchronizing or enriching MSSQL data with related information stored in PostgreSQL.

Practical examples:

  • Fetching a record by ID from an MSSQL table along with related data from other tables via left joins.
  • Creating a new record in an MSSQL table with optional GUID generation.
  • Updating specific columns of a record identified by ID.
  • Deleting a record by ID.
  • Retrieving records with dependency lookups in PostgreSQL to enrich the output.

Properties

Name Meaning
Primary Selects the primary database connection to use; options are "Click" or "PayamGostar".
Table The name of the table in the MSSQL database on which the operation will be performed.

Additional properties (not requested but relevant for context):

  • Operation: The CRUD action to perform — Get, Create, Update, or Delete.
  • Id: The identifier of the record (required for Get, Update, Delete).
  • Have Relation?: Boolean indicating if related tables should be joined when fetching data.
  • Relations: Configuration for related tables to join on Get operation.
  • Have Dependencies?: Boolean indicating if dependencies should be resolved from PostgreSQL on Get.
  • Dependencies: Configuration for dependency lookups in PostgreSQL.
  • Have Guid?: Boolean to indicate if a GUID should be generated on Create.
  • Merge?: Boolean to control merging of input properties with output data.
  • Fields: List of column-value pairs used for Create and Update operations.

Output

The node outputs JSON arrays representing the result of the executed SQL query:

  • For Get operations, it returns rows fetched from the specified MSSQL table, optionally including joined related tables and enriched dependency data from PostgreSQL.
  • For Create, it returns the newly created record's ID or GUID.
  • For Update and Delete, it returns the affected record(s) or confirmation of deletion.
  • If the "Merge?" option is enabled, the output JSON merges the original input properties with the database response under a props key.

No binary data output is produced by this node.

Dependencies

  • Requires valid credentials for two MSSQL connections ("Click" and "PayamGostar").
  • Requires credentials for a PostgreSQL database to resolve dependencies.
  • Uses helper modules for executing MSSQL queries and initializing PostgreSQL connections.
  • Environment must allow connectivity to these databases.
  • No external API keys beyond database credentials are needed.

Troubleshooting

  • Empty results on Get: Ensure the provided table name and ID exist in the MSSQL database. Check that relations and dependencies are correctly configured.
  • Query errors: Invalid SQL syntax may occur if field names or values contain special characters not properly escaped. The node wraps string values in single quotes but does not sanitize inputs beyond that.
  • Timeouts or delays: Dependency resolution involves asynchronous retries with delays; slow PostgreSQL responses can cause longer execution times.
  • Credential issues: Verify that MSSQL and PostgreSQL credentials are correct and have sufficient permissions.
  • Missing GUID on Create: If "Have Guid?" is enabled but no GUID is returned, check the database trigger or default value setup for GUID generation.

Links and References

Discussion