1Ci Support Help Center home page
Submit a request
Sign in
  1. 1Ci Support
  2. 1C:Enterprise Development Standards
  3. Data processing
  4. Working with queries

Specifics of using LIKE operator in queries

  • Working with queries
    • Creating query texts
    • Multiple execution of the similar queries
    • Checking for an empty query result
    • Restriction on the use of FULL EXTERNAL CONNECTION structure in queries
    • Using UNION and UNION ALL words in queries
    • Ordering query results
    • Rounding arithmetic results in queries
    • Specifics of using LIKE operator in queries
    • Data source aliases in queries

Scope: managed applications, mobile applications, and ordinary applications.

1. When using LIKE in query texts, use only constant string literals or query parameters. Do not generate a template string using calculation or use string concatenation with the query language. For example:

Valid:

Attribute LIKE "123%"

Invalid:

Attribute LIKE "123" + "%"
Attribute LIKE Table.Template

2. Queries where control characters of the LIKE operator template are in query fields or expressions being calculated are interpreted differently in various database management systems. Queries that are successfully executed, for example, when you use a file database can return incorrect results in client/server mode. Such expressions must be restated.

For example, instead of:

Query = NewQuery("
    |SELECT
    |    Goods.Ref
    |FROM
    |    Catalog.Goods AS Goods
    |WHERE
    |    Goods.OriginCountry.Description LIKE &CountryNameTemplate + "_"
    |");

Query.SetParameter("CountryNameTemplate", "NA");

Use:

Query = New Query("
    |SELECT
    |    Goods.Ref
    |FROM
    |    Catalog.Goods AS Goods
    |WHERE
    |    Goods.OriginCountry.Description LIKE &CountryNameTemplate
    |");

Query.SetParameter("CountryNameTemplate", "NA_");

This requirement is based on some specifics of migrating applications to various database management systems.

See also:

  • General requirements for configurations
  • Formatting query texts

     

© 2020 1C INTERNATIONAL LLC www.1Ci.com Support policy