# Sqlite INSERT command syntax

**URL:** <https://discourse.nodered.org/t/sqlite-insert-command-syntax/21471>\
**Category:** General\
**Created:** [10 February 2020 01:32 UTC](https://discourse.nodered.org/t/sqlite-insert-command-syntax/21471 "2020-02-10T01:32:28Z")\
**Posts on this page:** 1\
**Showing post:** 5

<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:** [10 February 2020 16:46 UTC](https://discourse.nodered.org/t/sqlite-insert-command-syntax/21471/5 "2020-02-10T16:46:30Z")

</div>

> [@NODE777](#):
>
> msg = "(UTC, DateTime, hp,lp) values (" + msg.payload + " , " + " datetime " + ", " + hp + ","+ lp + ")";

You have datetime in quotes so it has put that in as a string. You want something like

```auto
msg = "(UTC, DateTime, hp,lp) values (" + msg.payload + " , /"" + datetime + "/", " + hp + ","+ lp + ")";

```

I think it is easier to get right using the syntax

```auto
msg = `(UTC, DateTime, hp,lp) values (${msg.payload} , "${datetime}", ${hp}, ${lp})`;

```

Don't use msg as a variable name unless it is a message, you will get confused at some point if you do that. At least I would.  
Also it is good practice not to make a new message when returning, but return the original message after setting up the properties it needs.

---

_[View the full topic](https://discourse.nodered.org/t/sqlite-insert-command-syntax/21471)._
