Differentiating Table Names
From InterBase
Go Up to Working with Databases
In SQL, using multiple databases in transactions sometimes requires extra precautions to ensure intended behavior. When two or more databases have tables that share the same name, a database handle must be prefixed to those table names to differentiate them from one another in transactions.
A table name differentiated by a database handle takes the form:
handle.table
For example, the following cursor declaration accesses an EMPLOYEE
table in TEST
, and another EMPLOYEE
table in EMP
. TEST
and EMP
are used as prefixes to indicate which EMPLOYEE
table should be referenced:
. . . EXEC SQL DECLARE IDMATCH CURSOR FOR SELECT TESTNO INTO :matchid FROM TEST.EMPLOYEE WHERE (SELECT EMPNO FROM EMP.EMPLOYEE WHERE EMPNO = TESTNO); . . .
Note:
DSQL does not support access to multiple databases in a single statement.
DSQL does not support access to multiple databases in a single statement.