Underscore '_' included in Tag Mask Query

Discussion created by PFC5478 on Aug 14, 2014
Latest reply on Aug 14, 2014 by Gregor

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".




Many Thanks!