SQL Queries with LIKE on dyn_*

Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
Search

Post Reply
2 posts • Page 1 of 1
n.kuehl
Posts: 28
Joined: Mon Mar 18, 2019 9:35 am

SQL Queries with LIKE on dyn_*

Post by n.kuehl »

Hello,

I have an archived dyn_int datapoint and would like to use the WHERE statement to filter it upfront a request. I know the data is valid if the length is for example 7. My Idea was, i could use the the LIKE statement combined with wildcards. I got a working proof of concept query:
SELECT '_offline.._value', '_offline.._stime' FROM 'my_dp' WHERE '_offline.._value' LIKE \"? | ? | ? | ? | ? | ? | ?\" TIMERANGE(\"2021.05.01 00:00:00.000\",\"2021.06.30 00:00:00.000\",1,0)
It gives me all values with length of 7. If I want all data having a 16 on index 2 I would expect just replacing the second question mark. This gives me as well the expected result: All data containing a 16 at the second index inside my timerange.
But when I want to filter after the first index containing a 1, the result is empty, but there is data.

Is this an unexpected behavior or am I using it wrong? I am using WinCC OA v3.16 P27.

Best Regards

User avatar
leoknipp
Posts: 2926
Joined: Tue Aug 24, 2010 7:28 pm

Re: SQL Queries with LIKE on dyn_*

Post by leoknipp »

A query statement is a string and therefore filtering for dyn_int values (or any other dyn_array) possibly does not work as string filtering rules are applied.
Maybe it is also related to the type of database which are using for archiving (HDB, RDB).

Best Regards
Leopold Knipp
Senior Support Specialist

Post Reply
2 posts • Page 1 of 1