DATABASE | Teradata Vantage - DATABASE - Teradata Vantage - Analytics Database

SQL Stored Procedures and Embedded SQL

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2023-10-30
dita:mapPath
frc1628111662093.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
rjx1472253414573
lifecycle
latest
Product Category
Teradata Vantageā„¢

Specifies a default database.

ANSI Compliance

DATABASE is a Teradata extension to the ANSI/ISO SQL:2011 standard.

Invocation

Executable.

Embedded SQL only.

Syntax

DATABASE { database_name | database_name_variable }

Syntax Elements

database_name
An SQL identifier.
database_name_variable
A host variable.
The colon is mandatory.

Usage Notes

  • 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.