Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2026 08:27 AM
This is expected behaviour.
? parameter markers (with USING) are only for values, not for SQL identifiers.
When you pass a column name via ?, Databricks correctly treats it as a string literal, not as a column reference.
That’s why:
SELECT (?) FROM orders
returns a column containing the literal text o_orderpriority.
If you need to dynamically select a column name, you must build it into the SQL string:
SET sql_string = 'SELECT ' || column_name || ' FROM orders LIMIT 10'; EXECUTE IMMEDIATE sql_string;
Rule of thumb:
Identifiers (tables, columns) → string concatenation
Values → ? + USING
This separation is intentional for correctness and SQL injection safety.