Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

Examples

RDB/VMS SQL SET_ALIAS — VMS RDB_4.1A

 SET ALIAS ───┬─> alias-string-literal ────┬─> typebox (;)
              ├─> alias-parameter ─────────┤
              └─> alias-parameter-marker ──┘

 SET ALIAS specifies the default alias for a user session.  If
 you do not specify an alias, the default is RDB$DBHANDLE.

Additional information available:

Examples

Examples

 Example 1:  Setting a default alias to avoid qualifying object
 names.

 SQL> ATTACH 'ALIAS CORP FILENAME CORPORATE_DATA';
 SQL> SELECT LAST_NAME FROM EMPLOYEES;
 %SQL-F-NODEFDB, There is no default database
 SQL> ! You must qualify the table name because you attached with an alias
 SQL> SELECT LAST_NAME FROM CORP.EMPLOYEES;
  LAST_NAME
  Ames
  Andriola
  Babbin
 SQL> SET ALIAS 'CORP';
 SQL> ! Now you don't need to qualify the table name EMPLOYEES
 SQL> SQL> SELECT LAST_NAME FROM EMPLOYEES;
  LAST_NAME
  Ames
  Andriola
  Babbin

 Example 2:  Changing the default alias

 SQL> ATTACH 'FILENAME PERSONNEL';
 SQL> SHOW DATABASE;
 Default alias:
     Rdb/VMS database in file personnel
 SQL> ATTACH 'FILENAME CORPORATE_DATA';
 This alias has already been declared.
 Would you like to override this declaration (No)? Y

 There can only be one default alias.  The default alias,
 RDB$DBHANDLE, is now assigned to CORPORATE_DATA

 To set the default to a different database, change the default
 alias before attaching to a database.  The next database
 attached without an alias will be given the new default alias
 instead of RDB$DBHANDLE.

 SQL> SHOW DATABASES;
 Default alias:
     Rdb/VMS database in file corporate_data
 SQL> SET ALIAS 'CORP';
 SQL> ATTACH 'FILENAME PERSONNEL';
 SQL> SHOW DATABASES;
 Alias RDB$DBHANDLE:
     Rdb/VMS database in file corporate_data
 Default alias:
     Rdb/VMS database in file personnel

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026