# How to SELECT from MySQL and then INSERT result in MSSQL

**URL:** https://discourse.nodered.org/t/how-to-select-from-mysql-and-then-insert-result-in-mssql/74643
**Category:** General
**Created:** [3 February 2023 09:29 UTC](https://discourse.nodered.org/t/how-to-select-from-mysql-and-then-insert-result-in-mssql/74643 "2023-02-03T09:29:14Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![sahsha](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sahsha/32/43845_2.png) [@sahsha](https://discourse.nodered.org/u/sahsha)
#### Post date: [3 February 2023 09:29 UTC](https://discourse.nodered.org/t/how-to-select-from-mysql-and-then-insert-result-in-mssql/74643/1 "2023-02-03T09:29:14Z")

</div>

Please suggest a method where I get data using MySQL

> SELECT column 1, column 2, ..... column n FROM MySQL\_database

then insert the results using MSSQL node

> INSERT INTO MSSQL\_database  
> (column 1, column 2, ..... column n)  
> Values  
> (value a1, value a2,..... value an),  
> (value b1, value b2,..... value bn),  
> ....................  
> (value x1, value x2,..... value xn)

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [3 February 2023 09:44 UTC](https://discourse.nodered.org/t/how-to-select-from-mysql-and-then-insert-result-in-mssql/74643/2 "2023-02-03T09:44:18Z")

</div>

Which part don't you know how to do? What have you achieved so far?

---

<div class="post-metadata">

### Author: ![sahsha](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sahsha/32/43845_2.png) [@sahsha](https://discourse.nodered.org/u/sahsha)
#### Post date: [3 February 2023 10:59 UTC](https://discourse.nodered.org/t/how-to-select-from-mysql-and-then-insert-result-in-mssql/74643/3 "2023-02-03T10:59:12Z")

</div>

I haven't tried to run it with database  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/0/d093b1b937aa38c3864fa8f15da0dbdc419cc61c.png)

I used split node then join node.

[flows.json](https://discourse.nodered.org/uploads/short-url/uuQxBH04SBQ5KXE5odt52OhTvbH.json) (643.1 KB)  
but check if there is a better way.

I was trying to do this via function node alone.

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [3 February 2023 11:13 UTC](https://discourse.nodered.org/t/how-to-select-from-mysql-and-then-insert-result-in-mssql/74643/4 "2023-02-03T11:13:32Z")

</div>

node-red-contrib-mssql-plus has a bulk insert feature and it has a built-in demo named " **Bulk demo**" (use `CTRL-I` to view and import examples)

---

<div class="post-metadata">

### Author: ![sahsha](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sahsha/32/43845_2.png) [@sahsha](https://discourse.nodered.org/u/sahsha)
#### Post date: [3 February 2023 11:22 UTC](https://discourse.nodered.org/t/how-to-select-from-mysql-and-then-insert-result-in-mssql/74643/5 "2023-02-03T11:22:11Z")

</div>

Yes, I was just reading it. ([link](https://flows.nodered.org/node/node-red-contrib-mssql-plus))

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/4/7488269a63c08a9b06f6731502912bac1b7ac6e5.png)

But I don't know why example is missing in my node red. 🤷‍♂️  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/8/f8ba90c6a38ee209e96d5bc0f230d377a832ff45.png)

---

<div class="post-metadata">

### Author: ![sahsha](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sahsha/32/43845_2.png) [@sahsha](https://discourse.nodered.org/u/sahsha)
#### Post date: [3 February 2023 11:32 UTC](https://discourse.nodered.org/t/how-to-select-from-mysql-and-then-insert-result-in-mssql/74643/6 "2023-02-03T11:32:15Z")

</div>

coping form [github link](https://github.com/bestlong/node-red-contrib-mssql-plus/tree/master/examples).

---

<div class="post-metadata">

### Author: ![sahsha](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sahsha/32/43845_2.png) [@sahsha](https://discourse.nodered.org/u/sahsha)
#### Post date: [4 February 2023 11:46 UTC](https://discourse.nodered.org/t/how-to-select-from-mysql-and-then-insert-result-in-mssql/74643/7 "2023-02-04T11:46:45Z")

</div>

I tried 3 ways of doing it. Sharing flow if anyone might need it some day.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/3/33c2b1535360c61494c5106c0ef5afa32388eb3a.png)

[flows.json](https://discourse.nodered.org/uploads/short-url/6VGaNn2GWUbVCxcnlh1ok6VC0lo.json) (25.5 KB)

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [5 April 2023 11:47 UTC](https://discourse.nodered.org/t/how-to-select-from-mysql-and-then-insert-result-in-mssql/74643/8 "2023-04-05T11:47:04Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
