Purpose
Specifies a default database.
Invocation
Executable.
Embedded SQL only.
Syntax
DATABASE { database_name | database_name_variable }
- database_name
- An SQL identifier.
- database_name_variable
- A host variable.
ANSI Compliance
DATABASE is a Teradata extension to the ANSI/ISO SQL:2011 standard.
Rules for Using DATABASE
- Whether specified as database_name or as database_name_variable, the database name must be a valid SQL identifier.
- If you use the database_name_variable form, the host variable must follow the rules for SQL strings for the client language.
- You must ensure that your DATABASE specification is consistent with your DATABASE or -db Preprocessor2 specification.
While the statements and the options need not name the same database, all unqualified object references in the application program must resolve at application execution time to objects that are compatible with the ones they resolve to at precompile time.
- Referenced objects in multiple databases should use fully qualified names. Name resolution problems may occur if referenced databases contain tables or views with identical names and these objects are not fully qualified. Name resolution problems may even occur if the identically named objects are not themselves referenced.
- DATABASE is not valid when you specify the TRANSACT(2PC) option to Preprocessor2.