SQL_USE_DATABASE

Applies to: SQLFlex MYSQLFlex

This command is used to specify which database is used for SQL statements only. Any normal table queries or changes will still use the default database, this only effects SQL statements. If none is specified then the default database is used. This can be useful if a certain SQL statement needs to query data from a database not currently being used. Note that this only works if the table name is not fully qualified in the SQl statement, i.e. “TestDB.Customer”.

Syntax

SQL_USE_DATABASE of {server} to {database}

Parameter

Description

server

Name of the server (Postgre only)

database

Name of the database

Example

SQL_USE_DATABASE "testDB"

SQL_SET_STMT to "SELECT * FROM CUSTOMER WHERE STATUS = 'Active' "
SQL_PREPARE_STMT
SQL_EXECUTE_STMT
SQL_FETCH_NEXT_ROW into sID sFirstName sLastName
If (Found) Begin
    Showln sFirstName
    Showln sLastName
End
SQL_CANCEL_QUERY_STMT