Bubble input data to SQL Connector parameter

I am using the SQL Connector to move data into AWS RDS MSSQL DB. I don’t understand how to call Bubble data the user input in the app to fill in parameters for the SQL insert. Thanks.

The “Use as” field determines how the query is called.

As an action, it’ll show up under the Data section of a workflow action.

As data, it’ll show up under “Get data from external API”.

You’ll set the $1/$2 parameter values whenever you choose either of these methods. Does that help?

2 Likes

thanks Greg. did some hunting around using your guidance and i think we figured it out. appreciate your time and input! cheers

Hi Greg, Thanks again for the help. I’m doing an insert and it works as you’ve stated. My problem now is with the Insert statement. It’s not picking up the parameter $1 as the email address, but simply inserting a 1.

any hints?

When you initialize this query, does it insert the value “me” into the table?

no. it inserts 1. I verified with two parameters, and used $2 as well… which inserts a 2. It works the same when I initialize, update, as well as when used as an action in the application.

Is that column’s data type set to character strings or boolean?

EDIT: It sounds like it’s not detecting $2 as a parameter, and I’m not sure why… sorry, I’m not super savvy on SQL syntax.

varchar(50)

I agree, but I presume the connector should detect the use of the parameter and pass the query with the parameter value filled in. I posted as a separate question as well. Probably there’s a simple answer…

Are you specifying a column name after the table name? Syntax should be INSERT INTO table_name (column1, column2, column3, …) VALUES (value1, value2, value3, …) according to this.

I found an old query using insert into, which should work.

I tried that too…
Insert into Uname (Uname)
Values ($1);

result is the same.

If you don’t specify the columns to insert, it presumes all. Since I am just testing to get the basic function working, I’m using a single column table.

Does your original example where you Set Location using an Update query work? I also tested using an Update statement and it also passed the number of the parameter and not the value.

Ah, I see. Maybe you need to escape that $ somehow? My update query works… it could be a syntax discrepancy between my PostgreSQL and your MSSQL, seems Bubble isn’t able to catch that $1 and replace it with your value?

Hmmmm… darn. Sounds like a MS SQL related nuance. Hopefully the Bubble connector crew will have an answer.

FOUND IT! HERE: Not able to define SQL parameter on bubble - SQL query for dynamic search (multiple optional parameters)

MS SQL you need to use @ParameterName.

Thanks for your help!

1 Like

Great! :grinning: No problem at all, glad you figured it out