SQL Command

Official Content
This documentation is valid for:

To allow execution of SQL statements from GeneXus Client/Server applications.

Syntax

SQL [ Sql statement ]
 
Where:
[ SQL statement ]
 Statement to be executed. Character.

Description

The sentence after the SQL constant will be executed.
A comment will appear in the generated code, indicating that a user SQL statement is being executed.

Examples

  • You can use just a literal:
    SQL DELETE FROM CLIENTES
    

Or you can use variables. These should be between “ [ !” and “! ] ”:

&Role = "MyRole"
SQL SET ROLE TO [!&Role!]

Notes:

  • When using variables, make sure you use basic datatypes (CharacterNumber, etc), SDTs references are not allowed.
  • SQL commands are always executed in the default data store SAC 23118.
  • SQL command does not need to specify a semicolon at the end of the command.

Scope

Objects: Procedures, Transactions, Web Panels
Languages: .NET, Java, Ruby (up to GeneXus X Evolution 3), Visual FoxPro (up to GeneXus X Evolution 3)