IBM Support

Using square brackets in query filters on SQL Server and MS Access

Troubleshooting


Problem

On SQL Server and MS Access, square brackets have a special meaning when used in a query filter and require alternate specification to match literal square brackets.

Environment

This issue applies only to ClearQuest databases hosted on Microsoft SQL Server and Access. Note that Access is not supported for production use

Resolving The Problem

On SQL Server and MS Access, square brackets have a special meaning when used in a query filter. The square brackets are used to specify a set or range of characters, as in "[A-Z]" which would match any single character from 'A' to 'Z'. In order to match a square bracket explicitly, the bracket notation must be used with a left bracket in the character set, as in "[[]". For example, if the query is intended to find fields containing the exact string "fore [TAG] aft", use "fore [[]TAG] aft". Note that the right square bracket does not need any special handling.

[{"Product":{"code":"SSSH5A","label":"Rational ClearQuest"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Query","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"2003.06.00;7.0;7.0.1;7.1","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
16 June 2018

UID

swg21326414