# Write dynamic data to SQL DB

**URL:** <https://forum.bubble.io/t/write-dynamic-data-to-sql-db/6443>\
**Category:** Plugins\
**Created:** [September 28, 2016, 4:35am UTC](https://forum.bubble.io/t/write-dynamic-data-to-sql-db/6443 "2016-09-28T04:35:12Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![gbroady](https://avatars.discourse-cdn.com/v4/letter/g/ecb155/32.png) [@gbroady](https://forum.bubble.io/u/gbroady)\
**Post date:** [September 28, 2016, 4:35am UTC](https://forum.bubble.io/t/write-dynamic-data-to-sql-db/6443/1 "2016-09-28T04:35:12Z")

</div>

I’m attemping to use an INSERT statement but it doesn’t appear that I can pass dynamic data through the database connector plugin. Is there anyway to write dynamic data to an external DB from within Bubble?

Thanks a lot!

Garrett

---

<div class="post-metadata">

**Author:** ![emmanuel](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/emmanuel/32/27657_2.png) [@emmanuel](https://forum.bubble.io/u/emmanuel)\
**Post date:** [September 28, 2016, 5:26am UTC](https://forum.bubble.io/t/write-dynamic-data-to-sql-db/6443/2 "2016-09-28T05:26:53Z")

</div>

If you add parameters you should be able to define them dynamically. For instance, with mssql, you can do @name and then define a parameter name.

---

<div class="post-metadata">

**Author:** ![gbroady](https://avatars.discourse-cdn.com/v4/letter/g/ecb155/32.png) [@gbroady](https://forum.bubble.io/u/gbroady)\
**Post date:** [September 28, 2016, 5:09pm UTC](https://forum.bubble.io/t/write-dynamic-data-to-sql-db/6443/3 "2016-09-28T17:09:13Z")

</div>

to Clarify, how can I pull the parameters into my statement. If i have created a bubble parameter named Test, how will I call that into my insertinto statement. Doing it as believe is only returningi a NULL value. I assume it’s not initializing correctly.

INSERT INTO `iStrengthLabNew`.`Workout` (Exercise2) VALUES (@Test);

Do you think that I need to initialize the variables at some point? I have tried multiple ways to try to pass values via variables or the parameters, and nothing is working. This is a crucial part of my app as I need to write and read lots of data and if I can’t do it this way, i’m afraid I won’t be able to do it at all.

I love Bubble so far!! Thanks a lot for your help and let me knwo if you need more info to assist.

---

<div class="post-metadata">

**Author:** ![gbroady](https://avatars.discourse-cdn.com/v4/letter/g/ecb155/32.png) [@gbroady](https://forum.bubble.io/u/gbroady)\
**Post date:** [September 28, 2016, 5:14pm UTC](https://forum.bubble.io/t/write-dynamic-data-to-sql-db/6443/4 "2016-09-28T17:14:43Z")

</div>

I am using MySql also.

---

<div class="post-metadata">

**Author:** ![emmanuel](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/emmanuel/32/27657_2.png) [@emmanuel](https://forum.bubble.io/u/emmanuel)\
**Post date:** [September 29, 2016, 1:12pm UTC](https://forum.bubble.io/t/write-dynamic-data-to-sql-db/6443/5 "2016-09-29T13:12:59Z")

</div>

I “think” that mysql does it with a column “:”. For instance

`select :x + :x as z`

Can you try that?

---

<div class="post-metadata">

**Author:** ![victoria-williams](https://avatars.discourse-cdn.com/v4/letter/v/82dd89/32.png) [@victoria-williams](https://forum.bubble.io/u/victoria-williams)\
**Post date:** [October 30, 2016, 2:38pm UTC](https://forum.bubble.io/t/write-dynamic-data-to-sql-db/6443/6 "2016-10-30T14:38:05Z")

</div>

@gobroady did you manage to resolve this? I’m stuck with the same thing.

Thanks

Vicky

---

<div class="post-metadata">

**Author:** ![mishav](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mishav/32/6420_2.png) [@mishav](https://forum.bubble.io/u/mishav)\
**Post date:** [October 30, 2016, 7:00pm UTC](https://forum.bubble.io/t/write-dynamic-data-to-sql-db/6443/7 "2016-10-30T19:00:37Z")

</div>

For MySQL I got it working, like this:

**In the plugin page:**

insert into mytable (mycolumna, mycolumnb, mycolumnc) VALUES (?, ?, ?)

And then used the button Add Parameter three times and put appropriate names and types and test values. I think from memory that it does an actual insert with the test values.

I set the query to be used as an “Action”.

**In the Workflow page:**

Choose an action, Data (Things) \> queryname, then put values in for all the parameters that were defined in the plugin page.

I could only get it inserting one row at a time per action this way, if someone has worked out how to insert multiple rows from a list that’d be handy!

---

<div class="post-metadata">

**Author:** ![victoria-williams](https://avatars.discourse-cdn.com/v4/letter/v/82dd89/32.png) [@victoria-williams](https://forum.bubble.io/u/victoria-williams)\
**Post date:** [October 30, 2016, 7:10pm UTC](https://forum.bubble.io/t/write-dynamic-data-to-sql-db/6443/8 "2016-10-30T19:10:02Z")

</div>

Thanks so much for replying, I’ll give that a go.

Vics

---

<div class="post-metadata">

**Author:** ![victoria-williams](https://avatars.discourse-cdn.com/v4/letter/v/82dd89/32.png) [@victoria-williams](https://forum.bubble.io/u/victoria-williams)\
**Post date:** [November 4, 2016, 10:09pm UTC](https://forum.bubble.io/t/write-dynamic-data-to-sql-db/6443/9 "2016-11-04T22:09:08Z")

</div>

That worked great, onto the next thing. Thank you.  
Vics
