Dear OSISoft Support,
Our team found an issue and would like to get some possible solutions:
Assume there is two Tag "Test_123" (with underscore) and "Test-456" (with hyphen). When we query the Tag Mask "Test_*" in Basic Tag Search
of PI System Management Tools (PI SMT), only "Test_123" would be found. If we use Advanced Search in PI SMT by inputting "PIpoint.Tag = 'test_*'",
both "Test_123" and "Test-456" would be found.
Since we have use PI SQL in PI SDK and we need to query something like stmt = con.prepareStatement("SELECT tag FROM pisnapshot WHERE tag like 'test_*'");
and we want only Tag with Pattern like "Test_123" would be found, not something like "Test-456". We know '_' is a standard single character wildcard in standard SQL query
but we have also tried Tag Mask "PIpoint.Tag = 'test[_]*'" and none of tag can be found.
Please suggest how we can use PI SQL in PI SDK to only get "Test_123", not "Test-456".
This is a known issue. Please see KB00397 - Using Performance Equation (PE) expressions in PI ODBC Queries and 2812OSI8 - SQL treats underscore character "_" as a wildcard. I concur that the issue appears to be with PI SQL Subsystem. The workaround is to escape the underscore with a backslash. I was successful with 'Test\_*'
Retrieving data ...