# Building a dynamic msg.topic to create a mysql insert statement

**URL:** <https://discourse.nodered.org/t/building-a-dynamic-msg-topic-to-create-a-mysql-insert-statement/98024>\
**Category:** General\
**Created:** [8 July 2025 09:11 UTC](https://discourse.nodered.org/t/building-a-dynamic-msg-topic-to-create-a-mysql-insert-statement/98024 "2025-07-08T09:11:10Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [8 July 2025 12:13 UTC](https://discourse.nodered.org/t/building-a-dynamic-msg-topic-to-create-a-mysql-insert-statement/98024/14 "2025-07-08T12:13:00Z")

</div>

Yes, understood, really useful. I even got it to work without naming the field names before VALUES clause, as i am updating ALL the fields.

```auto
msg.topic = "INSERT INTO cc VALUES (:rdate, :totalcases, :totalcl, :caseperman, :costpercase, :cpm, :cpc)";
msg.payload = {
    "totalcases": 1234,
    "rdate": "2025-07-03",
    "caseperman": 49,
    "totalcl": 25,
    "costpercase": 39,
    "cpc": 25,
    "cpm": 52,
}

```

EDIT: Extremely Sorry @fogmajor for hijacking your thread. I will stop.

---

_[View the full topic](https://discourse.nodered.org/t/building-a-dynamic-msg-topic-to-create-a-mysql-insert-statement/98024)._
