I am trying to take data from a google sheet. There are multiple rows in the sheet. I need each row to be inserted as a new record into a MS SQL Database Table.
I couldn’t find a guide on how to do this? What is expected in the Column field within the n8n dialogue?
Also how do I handle multiple inserts instead of a single insert?
Hi @lawrence, the Microsoft SQL Server node works slightly different, but the basic approach is similar to what @nico-kow has shared for MySQL.
The main difference is that n8n expects a match between your field names in n8n and your column names in SQL Server (meaning you might need to use Rename Keys or the Set node to get these right before your actual Microsoft SQL node), simply because the SQL Server node is a bit older than the current MySQL node.
Here’s a quick example workflow:
Table structure
CREATE TABLE
users (
id int IDENTITY(1, 1) NOT NULL,
created_at datetime NOT NULL DEFAULT (sysutcdatetime()),
first_name varchar(255) NULL,
last_name varchar(255) NULL,
email varchar(255) NULL,
)
ALTER TABLE
users
ADD
CONSTRAINT PK__users__3213E83F24316926 PRIMARY KEY (id)
Workflow
In the Microsoft SQL node I am then specifying the field/column names rather then actual values (like I would in the MySQL node).
Result
This workflow leaves me with data like this in my table: