Using the LIKE statement in SQL

I am trying to run a query on a button, mouse-clicked event.
The query has the condition WHERE Description LIKE ‘%Stage’.
When I click the button I get the following error.

ValueError: unsupported format character ‘S’

Is there a way that I can use the % character in this query without ignition looking for a format character?

Sounds like the python interpreter is trying to process the SQL statement. You probably need to tweak the quoting a bit.

What’s the complete code look like?

That did it. The portion of the query that was giving the problem was:

system.db.runQuery(“SELECT BayType FROM BayTypes WHERE Description LIKE ‘%Stage’”)

I changed it to:

system.db.runQuery(“SELECT BayType FROM BayTypes WHERE Description LIKE '” + “%” + “Stage’”)

and it worked. Thanks.