Skip to main content
1-Visitor
Jun 19, 2019 3:25 PM UTC
Question

Wildcard in SQL query with input param

I need to make a SQL query in Thingworx. The query should read (if I were creating it directly):

SELECT * FROM MyDB.MyTable where Name like '%Name_Input%'

 

Another PTC forum post had recommended this as a possible solution:

SELECT * FROM MyDB.MyTable where Name like '%' || [[Name_Input]] || '%'

 

But this query (above) does not work. The post was from the year 2014 and I'm currently using 8.4.1, so I'm guessing that's the issue.....

 

Solutions anyone?

13 replies

20-Turquoise
Jun 20, 2019 5:50 PM UTC

This could have been changed due to the changed security policies. I will verify and get back to you/this thread with an update.

Translate
20-Turquoise
Jun 20, 2019 6:51 PM UTC

This was part of security updates, works to spec.

Translate
ague1-VisitorAuthor
1-Visitor
Jun 20, 2019 7:25 PM UTC

So, when you say, 'works to spec', are you saying that this SQL query should in fact work? 

Translate
11-Garnet
Oct 4, 2023 4:19 PM UTC

I had the same issue, here's what I found to work, this works in 9.4.1:
SELECT * FROM MyDB.MyTable where field_values LIKE '%'+[[source]]+'%'

Translate