User variable in custom SQL

======== TEMPLATE BUG FORM ========

Wappler Version : 2.1.7
Operating System : Mac / PHP

Expected behavior

What do you think should happen?

A custom query action should allow for a SQL User variable to be set, without prompting for a parameter.

Actual behavior

What actually happens?

The editor prompts for a parameter.

How to reproduce

  • Detail a step by step guide to reproduce the issue
  • A screenshot or short video indicating the problem
  • A copy of your code would help. Include: JS, HTML.
  • Test your steps on a clean page to see if you still have an issue

Create a custom query as shown and run

The SET statement alone is a valid sql command to create variables used within the execution of later commands.

Why would you use user variables in a query, when you do some complex logic then I would suggest creating a function or stored procedure for it on the sql server and call that.

1 Like

Thanks Patrick…your advice is fair. I’ll go that route.