Parameterized SQL Snippets
👤 This documentation is intended for SQL Users.
Parameterized snippets allow you to pass values directly into your snippets. They also help to make your queries more dynamic and provide a way to imitate passing variables into a function.
Defining a Parameterized Snippet
Let's start by creating a snippet for calculating percentage change. Specify the parameters used in the name of the snippet. Rounded parentheses are used to indicate the start and end of the parameter list and commas to separate the passed in
Now that the parameters have been defined in the name, they can be used in the snippet code by wrapping them in square brackets:
Writing Queries with Parameterized Snippets
To use a snippet in a query, call its name with square parentheses, and pass in actual columns or values as the parameters:
The generated code including how the snippet and parameters get substituted can be seen by clicking on the query tab.
Parameters with Commas
If parameters have commas, wrap them in double quotes "," to make sure they are passed in correctly.