- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2022 11:49 AM
I was trying to create a variable and i got the following error -
command -
SET a = 5;
Error -
Error running query
Configuration a is not available.
- Labels:
-
Databricks SQL
-
Error
-
Sqlserver
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2022 01:35 AM
@Sudeshna Bhakat what @Joseph Kambourakis described works on clusters but is restricted on Databricks SQL endpoints i.e. only a limited number of SET commands are allowed. I suggest you explore the curly-braces (e.g. {{ my_variable }}) in Databricks SQL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2022 09:42 AM
Hello @Sudeshna Bhakat
Thank you for posting on Databricks Community Forum
Could you please use Dashboard filters
https://docs.databricks.com/sql/user/queries/query-filters.html
Query
SELECT l_linenumber AS linenumber, COUNT(*) AS cnt FROM lineitem WHERE l_linenumber = {{var}}
GROUP BY l_linenumber
Query editor looks like below
When you add this query to the dashboard, the var looks like below
Dashboard
Please let us know if this works for you.
I have filed a feature request internally to support this.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2022 05:25 AM
Here is an example of the syntax:
set a.variablename = value
Then to use it you need to reference it with ${a.variablename}. See the screenshot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2022 01:35 AM
@Sudeshna Bhakat what @Joseph Kambourakis described works on clusters but is restricted on Databricks SQL endpoints i.e. only a limited number of SET commands are allowed. I suggest you explore the curly-braces (e.g. {{ my_variable }}) in Databricks SQL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2022 03:18 AM
Using curly braces means it will create parameters. but i don't need a parameter. There is no way other than creating a parameter?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2022 03:39 AM
No, not yet. For now, you can only use SET commands to set a limited number of configuration options.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2022 03:41 AM
Got your point. Thank you very much for the help

