SQL command

Official Content
This documentation is valid for:

Executes SQL statements from GeneXus Client/Server applications.

Syntax

SQL [ Sql statement ]
 
Where:

[ SQL statement ]
       Statement to be executed. Character.

Scope

Objects: ProcedureTransaction, Web Panel
Generators: .NET, .NET Framework, Java, Ruby (up to GeneXus X Evolution 3), Visual FoxPro (up to GeneXus X Evolution 3)

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.

Samples

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.
  • The statement executed cannot return any value, it cannot be processed from the GeneXus side.