How to launch SQL Request in Sage Enterprise Management

By | December 5, 2018

As you know, Sage Enterprise Management provides its own select, update statements like SQL. For efficiency, we can use SQL queries in Sage X3. Sage X3 provides special function to execute SQL statements/ commands. The special function is Execsql. It is used to launch a SQL request that does not require the return of information, unlike the instruction For…From…Sql that recovers the columns.  This instruction is used, for example, to launch a Sql grant command that is used to accord the rights to a table.


Execsql From type_base Sql sql_exp

type_base :  Alphanumeric character describing the database type.
sql_exp : Character string or character string grid containing the SQL request


YSQUERY(0)=” Update “+nomap+”.YTEMP set YFLAG_0 = 2 where YITMREF_0 =’ABC’ ”

Execsql From type_base Sql YSQUERY(0)

# in the creation and update process for the table structures.

Local Char BASE(1)
When 1 : BASE = “3”
When 2 : BASE = “5”
When 3 : BASE = “2”
When 4 : BASE = “4”

Here, we are updating table YTEMP with YFLAG field to 2.

The parameter type_base  is used to indicate the database type to be accessed :
– “o”,”O”,”3″ to describe an Oracle database
– “s”,”S”,”5″ to describe a SQL 7 database.

The sql_exp parameter is used to indicate the sql request. It is expressed by a character string or else a grid. When using a grid, the request expression is made up of the concatenation of character strings. This grid is limited to 255 elements.

Hope this helps!

About Us
Greytrix – a globally recognized Premier Sage Gold Development Partner is a one-stop solution provider for Sage ERP and Sage CRM needs. Being recognized and rewarded for multi-man years of experience, we bring complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third-party add-on development and implementation expertise.

Greytrix caters to a wide range of Sage Enterprise Management (Sage X3) offerings – a Sage Business Cloud Solution. Our unique GUMU™ integrations include Sage Enterprise Management (Sage X3) for Sage and Magento eCommerce along with Implementation and Technical Support worldwide for Sage Enterprise Management (Sage X3). Currently we are Sage Enterprise Management Implementation Partner in East Africa, Middles East, Australia, Asia. We also offer best-in-class Sage X3 customization and development services, integrated applications such as POS | WMS | Payment Gateway | Shipping System | Business Intelligence | eCommerce and have developed add-ons such as Catch – Weight  and Letter of Credit for Sage Enterprise Management to Sage business partners, end users and Sage PSG worldwide.

Greytrix is a recognized Sage Rockstar ISV Partner for GUMU™ Sage Enterprise Management – Sage CRM integration also listed on Sage Marketplace; GUMU™ integration for Sage Enterprise Management – Salesforce is a 5-star app listed on Salesforce AppExchange.

For more information on Sage X3 Integration and Services, please contact us at We will be glad to assist you.