Description
Temporarily includes a table in the database definition. To make this permanent, run Define_Database, or use the Database Manager.
Syntax
Attach_Table(locationlist, tablelist, database, options)
Parameters
The Attach_Table subroutine has the following parameters.
Parameter | Description |
---|---|
Locationlist | Specifies the location of the existing table. Can be specified in any of the following ways: [ location ] [ location, table_type ] [ location, table_type, control_table_path ] volume_pointer_name Typically, this value will be the path to a directory containing Native Tables. |
Tablelist | The table(s) to attach from the specified location. If you do not specify tablelist, then all tables at the specified location are attached when their associated database is the current application database. If no tables match the current database, tables with a GLOBAL database identifier are attached. |
Database | Pass a value, to override the default behavior (refer to tablelist), and to attach tables with a database identifier that does not match the current database identifier. |
Options | Reserved. Pass null. |
See also
Declare, Detach_Table, Alias_Table, Get_Status()
Example
/* Attach the OUTSTANDING table from the AP volume on the ACCT_PAY database. */ Attach_Table("AP", "OUTSTANDING", "ACCT_PAY", "") If Get_Status(StatusCode) Then GoSub Error_Processing /*Attach the EMP, JOBTABLE, and HISTORY tables from the default volume DATAVOL. */ TableList = "" TableList<1> = "EMP" TableList<2> = "JOB_TABLE" TableList<3> = "HISTORY" Attach_Table("DATAVOL", TableList, "", "") If Get_Status(StatusCode) Then GoSub Error_Processing *Attach entire DATAVOL volume. Attach_Table("DATAVOL", "", "", "") If Get_Status(StatusCode) Then GoSub Error_Processing
2 Comments
Don Bakke
If the Attach_Table command fails because the location is invalid (i.e., an FS109 error), this will clear any active cursors. Therefore, in order to prevent this from happening, surround the Attach_Table command with Push.Select and Pop.Select.
Don Bakke
If a row is already locked, running Attach_Table against the table will clear out the lock.