# MSSQL node imports "xxx... & ... " to "xxx... &amp; ..."

**URL:** https://discourse.nodered.org/t/mssql-node-imports-xxx-to-xxx-amp/47298
**Category:** General
**Created:** [17 June 2021 13:46 UTC](https://discourse.nodered.org/t/mssql-node-imports-xxx-to-xxx-amp/47298 "2021-06-17T13:46:52Z")
**Posts on this page:** 19
**Page:** 1

<div class="post-metadata">

### Author: ![IoTPlay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iotplay/32/40_2.png) [@IoTPlay](https://discourse.nodered.org/u/IoTPlay)
#### Post date: [17 June 2021 13:46 UTC](https://discourse.nodered.org/t/mssql-node-imports-xxx-to-xxx-amp/47298/1 "2021-06-17T13:46:52Z")

</div>

Hi, MSQL node converts the `"&"` into `"&amp;"` in a text field.

Here is the code in the MSSQL node:

> INSERT INTO [mrs\_Work]  
> (PrjNo, ProjectName)  
> VALUES (  
> '{{{payload.PrjNo}}}',  
> '{{{payload.ProjectName}}}'  
> )

The inbound field `msg.payload.ProjectName` contains - for instance" `Integrated Plan & Schedule` - which then is stored in MSSQL as `Integrated Plan &amp; Schedule`

How can I stop this conversion?

---

<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: [17 June 2021 13:52 UTC](https://discourse.nodered.org/t/mssql-node-imports-xxx-to-xxx-amp/47298/2 "2021-06-17T13:52:08Z")

</div>

> [@IoTPlay](#):
>
> How can I stop this conversion

If you are using node-red-contrib-mssql-plus you can setup parameters in the UI & use them in the query...

```auto
INSERT INTO [mrs_Work]
(PrjNo, ProjectName)
VALUES (
  @PrjNo,
  @ProjectName
)

```

Better still, create a stored procedure & pass in parameters.

See the 1st screenshot in the [readme](https://flows.nodered.org/node/node-red-contrib-mssql-plus)

---

<div class="post-metadata">

### Author: ![IoTPlay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iotplay/32/40_2.png) [@IoTPlay](https://discourse.nodered.org/u/IoTPlay)
#### Post date: [17 June 2021 15:31 UTC](https://discourse.nodered.org/t/mssql-node-imports-xxx-to-xxx-amp/47298/3 "2021-06-17T15:31:24Z")

</div>

Thank you! I will try it and report back. But I am using node `node-red-contrib-mssql-plus`.

---

<div class="post-metadata">

### Author: ![IoTPlay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iotplay/32/40_2.png) [@IoTPlay](https://discourse.nodered.org/u/IoTPlay)
#### Post date: [17 June 2021 16:28 UTC](https://discourse.nodered.org/t/mssql-node-imports-xxx-to-xxx-amp/47298/4 "2021-06-17T16:28:35Z")

</div>

@Steve-Mcl - found my problem - mybad, I had a text string inserted with `'{{x}}'`, instead of `'{{x}}}'` in the node.

I am doing bulk'ish upload, 9300 records, did not know there were a beta solution - I came over the problem by batching in batches of 1000 - once you come ou of beta - I will use that rather. the 10,000 records are growing ...

---

<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: [17 June 2021 17:01 UTC](https://discourse.nodered.org/t/mssql-node-imports-xxx-to-xxx-amp/47298/5 "2021-06-17T17:01:50Z")

</div>

Bulk insert is out of beta. Are you running v0.7.1?

Also, are the updates/inserts coming from free text? Using mustache is vulnerable to SQL injection hacks, you would be better off taking my advice about using parameters or stored procedure.

---

<div class="post-metadata">

### Author: ![IoTPlay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iotplay/32/40_2.png) [@IoTPlay](https://discourse.nodered.org/u/IoTPlay)
#### Post date: [17 June 2021 17:04 UTC](https://discourse.nodered.org/t/mssql-node-imports-xxx-to-xxx-amp/47298/6 "2021-06-17T17:04:51Z")

</div>

Just upgraded to 0.7.1 - okay - did not know - let me refactor to use Bulk - right now I package an array of 1000 objects, then through them at a Spit note - feed them into the MSSQL node - one at a time, 2 seconds later the next 1000, and so on, but still getting niggling errors.

Let me see how to do that - and get rid of mustaches....

---

<div class="post-metadata">

### Author: ![IoTPlay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iotplay/32/40_2.png) [@IoTPlay](https://discourse.nodered.org/u/IoTPlay)
#### Post date: [17 June 2021 17:06 UTC](https://discourse.nodered.org/t/mssql-node-imports-xxx-to-xxx-amp/47298/7 "2021-06-17T17:06:25Z")

</div>

> [@Steve-Mcl](#):
>
> are the updates/inserts coming from free text?

I download from our ERP into a spreadsheet, then use the Excel node to package it into a json Array, then point that to the 1000' breaker upper....

---

<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: [17 June 2021 17:08 UTC](https://discourse.nodered.org/t/mssql-node-imports-xxx-to-xxx-amp/47298/8 "2021-06-17T17:08:28Z")

</div>

Yuk. What a kerfuffle.

Doesn't the ERP have a callable endpoint to avoid the whole excel part?

---

<div class="post-metadata">

### Author: ![IoTPlay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iotplay/32/40_2.png) [@IoTPlay](https://discourse.nodered.org/u/IoTPlay)
#### Post date: [17 June 2021 17:15 UTC](https://discourse.nodered.org/t/mssql-node-imports-xxx-to-xxx-amp/47298/9 "2021-06-17T17:15:14Z")

</div>

Yes, it has, but IT does not want to let me in .... 8-( Still busy convincing them. IN the mean time - I must run a business.,.....

---

<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: [17 June 2021 17:16 UTC](https://discourse.nodered.org/t/mssql-node-imports-xxx-to-xxx-amp/47298/10 "2021-06-17T17:16:49Z")

</div>

> [@IoTPlay](#):
>
> but IT does not want to let me in

I never understand that. If there is a http endpoint that has been coded correctly there is nothing your application can do to break the ERP.

Bloody IT. 😉

---

<div class="post-metadata">

### Author: ![IoTPlay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iotplay/32/40_2.png) [@IoTPlay](https://discourse.nodered.org/u/IoTPlay)
#### Post date: [17 June 2021 17:16 UTC](https://discourse.nodered.org/t/mssql-node-imports-xxx-to-xxx-amp/47298/11 "2021-06-17T17:16:51Z")

</div>

Funny, examples not showing....

![No Examples](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/4/144ed63ab367a95ea5b1623d65b72028ab112d4c.png)

---

<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: [17 June 2021 17:17 UTC](https://discourse.nodered.org/t/mssql-node-imports-xxx-to-xxx-amp/47298/12 "2021-06-17T17:17:33Z")

</div>

Where is it running? Have you refreshed browser after update?

---

<div class="post-metadata">

### Author: ![IoTPlay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iotplay/32/40_2.png) [@IoTPlay](https://discourse.nodered.org/u/IoTPlay)
#### Post date: [17 June 2021 17:18 UTC](https://discourse.nodered.org/t/mssql-node-imports-xxx-to-xxx-amp/47298/13 "2021-06-17T17:18:06Z")

</div>

> [@Steve-Mcl](#):
>
> Bloody IT. 😉

Okay to download in a spreadsheet.... but not an end-point - as then I have access to the data. Wait until they find out I am pushing it into SQL .... from the spreadsheet.......

---

<div class="post-metadata">

### Author: ![IoTPlay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iotplay/32/40_2.png) [@IoTPlay](https://discourse.nodered.org/u/IoTPlay)
#### Post date: [17 June 2021 17:20 UTC](https://discourse.nodered.org/t/mssql-node-imports-xxx-to-xxx-amp/47298/14 "2021-06-17T17:20:31Z")

</div>

> [@Steve-Mcl](#):
>
> Where is it running? Have you refreshed browser after update?

Closed browser now, re-opened, still not working. Safari in Mac. MS SQL on a NAS on Ubuntu - in Docker container.... Sweat solution .....

---

<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: [17 June 2021 17:25 UTC](https://discourse.nodered.org/t/mssql-node-imports-xxx-to-xxx-amp/47298/15 "2021-06-17T17:25:12Z")

</div>

Most odd.

You can get examples [here](https://github.com/bestlong/node-red-contrib-mssql-plus/tree/master/examples)

---

<div class="post-metadata">

### Author: ![IoTPlay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iotplay/32/40_2.png) [@IoTPlay](https://discourse.nodered.org/u/IoTPlay)
#### Post date: [17 June 2021 17:27 UTC](https://discourse.nodered.org/t/mssql-node-imports-xxx-to-xxx-amp/47298/16 "2021-06-17T17:27:01Z")

</div>

Now not sure how I will use BULK. Can I point a 10,000 msg.payload formatted in JSON, array with 10,000 objects at it too? Do not want to download a spreadsheet from ERP, then by hand convert that into CSV, with all the problems with commas in fields, and then point a CSV to the MSSQL node. But let me look into your examples to see if such solutions exists.

---

<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: [17 June 2021 17:28 UTC](https://discourse.nodered.org/t/mssql-node-imports-xxx-to-xxx-amp/47298/17 "2021-06-17T17:28:48Z")

</div>

> [@IoTPlay](#):
>
> not sure how I will use BULK. Can I point a 10,000 msg.payload formatted in JSON, array with 10,000 objects at it

If formatted correctly yes.

Have a look at example.

---

<div class="post-metadata">

### Author: ![IoTPlay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iotplay/32/40_2.png) [@IoTPlay](https://discourse.nodered.org/u/IoTPlay)
#### Post date: [17 June 2021 17:33 UTC](https://discourse.nodered.org/t/mssql-node-imports-xxx-to-xxx-amp/47298/18 "2021-06-17T17:33:00Z")

</div>

FLIPPEN HELL !!!! Ran the Bulk demo now, IT IS BLAZINGLY FAST !!!

---

<div class="post-metadata">

### Author: ![IoTPlay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iotplay/32/40_2.png) [@IoTPlay](https://discourse.nodered.org/u/IoTPlay)
#### Post date: [17 June 2021 20:48 UTC](https://discourse.nodered.org/t/mssql-node-imports-xxx-to-xxx-amp/47298/19 "2021-06-17T20:48:17Z")

</div>

Okay - got your BULK thing working, deleted reams and reams of work-around flows I had to build. Thank you Steve.
