Back to Integrations
integrationMicrosoft SQL node
integrationOpenAI node

Microsoft SQL and OpenAI integration

Save yourself the work of writing custom integrations for Microsoft SQL and OpenAI and use n8n instead. Build adaptable and scalable Development, Data & Storage, AI, and Langchain workflows that work with your technology stack. All within a building experience you will love.

How to connect Microsoft SQL and OpenAI

  • Step 1: Create a new workflow
  • Step 2: Add and configure nodes
  • Step 3: Connect
  • Step 4: Customize and extend your integration
  • Step 5: Test and activate your workflow

Step 1: Create a new workflow and add the first step

In n8n, click the "Add workflow" button in the Workflows tab to create a new workflow. Add the starting point – a trigger on when your workflow should run: an app event, a schedule, a webhook call, another workflow, an AI chat, or a manual trigger. Sometimes, the HTTP Request node might already serve as your starting point.

Microsoft SQL and OpenAI integration: Create a new workflow and add the first step

Step 2: Add and configure Microsoft SQL and OpenAI nodes

You can find Microsoft SQL and OpenAI in the nodes panel. Drag them onto your workflow canvas, selecting their actions. Click each node, choose a credential, and authenticate to grant n8n access. Configure Microsoft SQL and OpenAI nodes one by one: input data on the left, parameters in the middle, and output data on the right.

Microsoft SQL and OpenAI integration: Add and configure Microsoft SQL and OpenAI nodes

Step 3: Connect Microsoft SQL and OpenAI

A connection establishes a link between Microsoft SQL and OpenAI (or vice versa) to route data through the workflow. Data flows from the output of one node to the input of another. You can have single or multiple connections for each node.

Microsoft SQL and OpenAI integration: Connect Microsoft SQL and OpenAI

Step 4: Customize and extend your Microsoft SQL and OpenAI integration

Use n8n's core nodes such as If, Split Out, Merge, and others to transform and manipulate data. Write custom JavaScript or Python in the Code node and run it as a step in your workflow. Connect Microsoft SQL and OpenAI with any of n8n’s 1000+ integrations, and incorporate advanced AI logic into your workflows.

Microsoft SQL and OpenAI integration: Customize and extend your Microsoft SQL and OpenAI integration

Step 5: Test and activate your Microsoft SQL and OpenAI workflow

Save and run the workflow to see if everything works as expected. Based on your configuration, data should flow from Microsoft SQL to OpenAI or vice versa. Easily debug your workflow: you can check past executions to isolate and fix the mistake. Once you've tested everything, make sure to save your workflow and activate it.

Microsoft SQL and OpenAI integration: Test and activate your Microsoft SQL and OpenAI workflow

Flexible currency rate uploads for SAP B1 with AI validation & multiple sources

This workflow automates currency rate uploads into SAP Business One via Service Layer, using flexible input sources such as JSON (API), SQL Server, Google Sheets, or manual values. It leverages logic branching, AI validation, and logging for complete control and traceability.

++⚙️ HOW IT WORKS:++
🔹 1. Receive Data via Webhook

The workflow listens on the endpoint /formulario-datos via HTTP POST.

The request body should include:

origen: one of JSON, SQL, GoogleSheets, or Manual

Depending on the value, the flow branches accordingly.

🔹 2. Authenticate with SAP Business One

A POST request is sent to SAP B1’s Login endpoint.

A session cookie (B1SESSION) is retrieved and used in all subsequent API calls.

🔹 3. Switch by Origin
The flow branches into four processing paths based on origen:

JSON:

The payload is normalized using OpenAI to extract an array of rates.

Each rate is sent to SAP individually after parsing.

SQL:

The SQL query provided in the payload is executed on a connected Microsoft SQL Server.

The results are checked by AI to validate the date format.

If valid, rates are sent to SAP.

GoogleSheets:

Rates are pulled from a connected spreadsheet.

Each entry is sent to SAP in sequence.

Manual:

Uses currency, rate, and rateDate directly from the webhook payload.

Sends the result directly to SAP.

🔹 4. AI-Powered Enhancements (Optional but enabled)

Normalize JSON:
Uses OpenAI (LangChain node) to convert any messy structure into a uniform array under the key rate.

Date Formatting:
Another OpenAI call ensures RateDate is in yyyyMMdd format (required by SAP), converting from ISO, timestamp, or other formats.

🔹 5. Send to SAP Business One (Service Layer)
All paths send a POST request to:

/SBOBobService_SetCurrencyRate
With a payload such as:

{
"Currency": "USD",
"Rate": "0.92",
"RateDate": "20250612"
}

🔹 6. Log Results

All success/failure results are appended to a Google Sheets log (LOGS_N8N)

The log includes method, URL, sent payload, status code, and message.

++🛠 SETUP STEPS:++

1️⃣ Create Required Credentials:
Go to Credentials > + New Credential and configure:

SAP Business One (Service Layer)

Type: HTTP Request Auth or Token

Base URL: https://<your-host>:50000/b1s/v1/

Provide Username, Password, and CompanyDB via variables or fields

Google Sheets

OAuth2 connection to a Google account with access

Microsoft SQL Server

SQL login credentials and host

OpenAI

API key with access to models like GPT-4o

2️⃣ Environment Variables (Recommended)
Set these variables in n8n → Settings → Variables:

SAP_URL=https://<host>:50000/b1s/v1/
SAP_USER=your_username
SAP_PASSWORD=your_password
SAP_COMPANY_DB=your_companyDB

3️⃣ Prepare Google Sheets
Sheet 1: RATE (for charging the data)

Columns: Currency, Rate, RateDate

Sheet 2: LOGS_N8N (to save the logs, success or failed)

Columns: workflow, method, url, json, status_code, message

4️⃣ Activate and Test
Deploy the webhook and grab the URL.

++✅ BONUS++
Built-in AI assistance for input validation and structure

Logs all results for compliance and audit

Flexible integration paths: perfect for hybrid or transitional systems

Nodes used in this workflow

Popular Microsoft SQL and OpenAI workflows

Flexible Currency Rate Uploads for SAP B1 with AI Validation & Multiple Sources

This workflow automates currency rate uploads into SAP Business One via Service Layer, using flexible input sources such as JSON (API), SQL Server, Google Sheets, or manual values. It leverages logic branching, AI validation, and logging for complete control and traceability. ++⚙️ HOW IT WORKS:++ 🔹 1. Receive Data via Webhook The workflow listens on the endpoint /formulario-datos via HTTP POST. The request body should include: origen: one of JSON, SQL, GoogleSheets, or Manual Depending on the value, the flow branches accordingly. 🔹 2. Authenticate with SAP Business One A POST request is sent to SAP B1’s Login endpoint. A session cookie (B1SESSION) is retrieved and used in all subsequent API calls. 🔹 3. Switch by Origin The flow branches into four processing paths based on origen: JSON: The payload is normalized using OpenAI to extract an array of rates. Each rate is sent to SAP individually after parsing. SQL: The SQL query provided in the payload is executed on a connected Microsoft SQL Server. The results are checked by AI to validate the date format. If valid, rates are sent to SAP. GoogleSheets: Rates are pulled from a connected spreadsheet. Each entry is sent to SAP in sequence. Manual: Uses currency, rate, and rateDate directly from the webhook payload. Sends the result directly to SAP. 🔹 4. AI-Powered Enhancements (Optional but enabled) Normalize JSON: Uses OpenAI (LangChain node) to convert any messy structure into a uniform array under the key rate. Date Formatting: Another OpenAI call ensures RateDate is in yyyyMMdd format (required by SAP), converting from ISO, timestamp, or other formats. 🔹 5. Send to SAP Business One (Service Layer) All paths send a POST request to: /SBOBobService_SetCurrencyRate With a payload such as: { "Currency": "USD", "Rate": "0.92", "RateDate": "20250612" } 🔹 6. Log Results All success/failure results are appended to a Google Sheets log (LOGS_N8N) The log includes method, URL, sent payload, status code, and message. ++🛠 SETUP STEPS:++ 1️⃣ Create Required Credentials: Go to Credentials > + New Credential and configure: SAP Business One (Service Layer) Type: HTTP Request Auth or Token Base URL: https://<your-host>:50000/b1s/v1/ Provide Username, Password, and CompanyDB via variables or fields Google Sheets OAuth2 connection to a Google account with access Microsoft SQL Server SQL login credentials and host OpenAI API key with access to models like GPT-4o 2️⃣ Environment Variables (Recommended) Set these variables in n8n → Settings → Variables: SAP_URL=https://<host>:50000/b1s/v1/ SAP_USER=your_username SAP_PASSWORD=your_password SAP_COMPANY_DB=your_companyDB 3️⃣ Prepare Google Sheets Sheet 1: RATE (for charging the data) Columns: Currency, Rate, RateDate Sheet 2: LOGS_N8N (to save the logs, success or failed) Columns: workflow, method, url, json, status_code, message 4️⃣ Activate and Test Deploy the webhook and grab the URL. ++✅ BONUS++ Built-in AI assistance for input validation and structure Logs all results for compliance and audit Flexible integration paths: perfect for hybrid or transitional systems

Build your own Microsoft SQL and OpenAI integration

Create custom Microsoft SQL and OpenAI workflows by choosing triggers and actions. Nodes come with global operations and settings, as well as app-specific parameters that can be configured. You can also use the HTTP Request node to query data from any app or service with a REST API.

Microsoft SQL supported actions

Execute Query
Execute an SQL query
Insert
Insert rows in database
Update
Update rows in database
Delete
Delete rows in database

OpenAI supported actions

Message a Model
Generate a model response with GPT 3, 4, 5, etc. using Responses API
Classify Text for Violations
Check whether content complies with usage policies
Analyze Image
Take in images and answer questions about them
Generate an Image
Creates an image from a text prompt
Edit Image
Edit an image
Generate Audio
Creates audio from a text prompt
Transcribe a Recording
Transcribes audio into text
Translate a Recording
Translates audio into text in English
Delete a File
Delete a file from the server
List Files
Returns a list of files that belong to the user's organization
Upload a File
Upload a file that can be used across various endpoints
Create
Create a conversation
Get
Get a conversation
Remove
Remove a conversation
Update
Update a conversation
Generate
Creates a video from a text prompt

Microsoft SQL and OpenAI integration details

Use case

Save engineering resources

Reduce time spent on customer integrations, engineer faster POCs, keep your customer-specific functionality separate from product all without having to code.

Learn more

FAQs

  • Can Microsoft SQL connect with OpenAI?

  • Can I use Microsoft SQL’s API with n8n?

  • Can I use OpenAI’s API with n8n?

  • Is n8n secure for integrating Microsoft SQL and OpenAI?

  • How to get started with Microsoft SQL and OpenAI integration in n8n.io?

Need help setting up your Microsoft SQL and OpenAI integration?

Discover our latest community's recommendations and join the discussions about Microsoft SQL and OpenAI integration.
Artem
sérgio eduardo floresta filho
Andrew adawdad
PinkFloyd
Steve Warburton

Looking to integrate Microsoft SQL and OpenAI in your company?

Over 3000 companies switch to n8n every single week

Why use n8n to integrate Microsoft SQL with OpenAI

Build complex workflows, really fast

Build complex workflows, really fast

Handle branching, merging and iteration easily.
Pause your workflow to wait for external events.

Code when you need it, UI when you don't

Simple debugging

Your data is displayed alongside your settings, making edge cases easy to track down.

Use templates to get started fast

Use 1000+ workflow templates available from our core team and our community.

Reuse your work

Copy and paste, easily import and export workflows.

Implement complex processes faster with n8n

red iconyellow iconred iconyellow icon