cancel
Showing results for 
Search instead for 
Did you mean: 
Warehousing & Analytics
Engage in discussions on data warehousing, analytics, and BI solutions within the Databricks Community. Share insights, tips, and best practices for leveraging data for informed decision-making.
cancel
Showing results for 
Search instead for 
Did you mean: 

Databricks SQL Wildcard Operator Not Parsed Correctly

nomnomnom543
Visitor

Hello there,

Wasn't sure if this was just an error on my part, but I'm using a Databricks Pro SQL warehouse and unity catalogue to pull some data from my tables. I'm having this issue where whenever I try and use a wildcard operator with my LIKE clause, I'm getting a Parse error. 

When I write a query like SELECT * FROM table_name WHERE column_name LIKE 'string' it works fine. But when I include a wildcard operator in my query, SELECT * FROM table_name WHERE column_name LIKE 'string%', then it throws a parse error. Specifically the error says, Parse error at line: 1, column: 3620: Incorrect syntax near ''%string%'', with the string portion surrounded by two single quotes. 

My column is a string  column in the table. Anyone else experience something similar?

2 REPLIES 2

Walter_C
Databricks Employee
Databricks Employee

Is this only happening with Pro warehouse, if you test with Serverless for example does it work? I have tested using syntax 
SELECT * FROM table_name WHERE column_name LIKE 'string%' and it has worked as expected for me on Serverless.

nomnomnom543
Visitor

My organization doesn't have serverless SQL enabled, so I'm not able to try that out. But I did try a query with a wildcard operator on a different table and Pro warehouse and it worked like expected. Looks like it might be an issue with the table itself. 

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group