IDalCommand.SQL

Syntax

SQL: String;

Description

The SQL property determines an SQL query that must be executed at the database server.

Comments

A physical name of the procedure or function stored at the server is passed as a query using Type=StoredProcedure.

Example

Executing the example requires that the repository contains a database with the BD identifier.

Add links to the Dal, Db, and Metabase system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    DB: IDatabaseInstance;
    Com: IDalCommand;
Begin
    MB := MetabaseClass.Active;
    DB := MB.ItemById("BD").Open(NullAs IDatabaseInstance;
    Com := DB.Connection.CreateCommand("");
    Com.SQL := "Select * from Table_1";
    Com.Execute;
    Com.Close;
End Sub UserProc;

After executing the example the connection to the BD database is established, After which the SQL query, which selects all records from the Table_1 table, is executed.

See also:

IDalCommand