Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2025 12:16 PM
Root Cause
- In your SQL statement, where IDs in (ID) is comparing a string column (IDs) with an array variable (ARRAY<STRING>).
- Databricks SQL does not allow IN to directly take an array — IN expects a list of scalar values, not an array object.
That’s why you see the error
Solution:
Try Using array_contains to structure your query.
Use array_contains
If you’re filtering using an array variable:
DECLARE ids ARRAY<STRING>;
SET VARIABLE ids = ARRAY('12483258','12483871','12483883');
CREATE TABLE check1 AS
SELECT *
FROM dataA
WHERE array_contains(ids, IDs);