FetchSQL function
Syntax
FetchSQL([SQL.]sqlname[, dbtype[, effdt]] )
Description
Use the FetchSQL function to return the SQL definition with the given sqlname as SQL.sqlname or a string value, matching the dbtype and effdt. If sqlname is a literal name, it must be in quotes.
Parameters
| Parameter | Description |
|---|---|
|
sqlname |
Specify the name of a SQL definition. This is either in the form SQL.sqlname or a string value giving the sqlname. |
|
dbtype |
Specify the database type associated with the SQL definition. This parameter takes a string value. If dbtype isn’t specified or is null (""), it is set by default to the current database type (the value returned from the %DbType system variable.) Values for dbtype are as follows. These values are not case-sensitive:
Note: Database platforms are subject to change. |
|
effdt |
Specify the effective date associated with the SQL definition. If effdt isn’t specified, it is set by default to the current as of date, that is, the value returned from the %AsOfDate system variable. |
Returns
The SQL statement associated with sqlname as a string.
Example
The following code gets the text associated with the ABCD_XY SQL Definition for the current DBType and as of date:
&SQLSTR = FetchSQL(SQL.ABC_XY);
The following code gets the text associated with the ABCD_XY SQL Definition for the current DBType and November 3, 1998:
&SQLSTR = FetchSQL(SQL.ABCD_XY, "", Date(19981103));