'sql:query' - Error when using < or > symbols
search cancel

'sql:query' - Error when using < or > symbols

book

Article ID: 56394

calendar_today

Updated On: 08-10-2023

Products

Clarity PPM SaaS Clarity PPM On Premise

Issue/Introduction

Getting an error when using greater than or less than symbols (>, <) in WHERE clause of SQL Query section in GEL Script

Steps to Reproduce:

  1. Created the GEL script
  2. Added the SQL Query section
    Example:
    <sql:query var="results">
      select count(*)
      as projcount
      from srm_projects
      where id > 5000000
    </sql:query>
  3. Execute the command to validate the file, it gives error:
    Internal error: file:/P:/sql_test3.xml:16:27: <sql:query> select count(*) as projcount from srm_projects where id > 5015143: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near ';'.

Resolution

In Jelly <sql:query> tag, the "<" or ">" operators are not allowed. So this is an issue with Jelly and not with Gel Script. Use the "BETWEEN" operator in the WHERE clause instead of '<' or '>'.