I am writing an Access database update program in Java using UCANACCESS 3.0.2. I can access the .mdb file and read and build tables, but I am having a problem with LIKE operators.
I cannot use [0-9] in a LIKE statement. In the example shown, I am trying to select part numbers from a table named TEST. In this example I can use percent or asterisk or hash and get the same result of 4 lines selected from the table, since there are four lines in the table that match the text and end with a numeral.
selTable = "SELECT part_number FROM TEST "+
"WHERE (TEST.part_number LIKE '10-59-8000%')";
rs = s.executeQuery(selTable);
When I try to change the query to use brackets to select a group of acceptable characters.
selTable = "SELECT part_number FROM TEST "+
"WHERE (TEST.part_number LIKE '10-59-8000[0-9]')";
rs = s.executeQuery(selTable);
This selects zero lines.
The features list for UCANACCESS says it handles brackets for defining character intervals.
Sure I can work around this with the hash character, but what if I need a different set of characters, like [A-F]?
Also, I know MSAccess and UCANACCESS are not the same, but just for completeness I tested and the brackets do work in queries inside MSAccess.
Thanks for any suggestions!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
[A-F],[!A-F] should work. If [0-9] doesn't, it's a bug. No time to confirm in this very moment, but if so, I'll fix it next week and release the bug fix with the 3.0.3.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am writing an Access database update program in Java using UCANACCESS 3.0.2. I can access the .mdb file and read and build tables, but I am having a problem with LIKE operators.
I cannot use [0-9] in a LIKE statement. In the example shown, I am trying to select part numbers from a table named TEST. In this example I can use percent or asterisk or hash and get the same result of 4 lines selected from the table, since there are four lines in the table that match the text and end with a numeral.
When I try to change the query to use brackets to select a group of acceptable characters.
This selects zero lines.
The features list for UCANACCESS says it handles brackets for defining character intervals.
Sure I can work around this with the hash character, but what if I need a different set of characters, like [A-F]?
Also, I know MSAccess and UCANACCESS are not the same, but just for completeness I tested and the brackets do work in queries inside MSAccess.
Thanks for any suggestions!
[A-F],[!A-F] should work. If [0-9] doesn't, it's a bug. No time to confirm in this very moment, but if so, I'll fix it next week and release the bug fix with the 3.0.3.
Fixed in svn trunk(digit intervals allowed).