DATABASE

Syntax:

DATABASE [ switches ]

Description: Inserts the results of a database query into a WordprocessingML table. If the number of columns is 62 or more, the field inserts the results of a query in columns separated by tabs. The DATABASE field contains all the information needed to connect to a database and perform an SQL query. Each time the field is updated, the database is queried again.

Field Value: The results of a database query as a WordprocessingML table.

Switches: Zero or more of the following field-specific-switches.

\b field-argument

The text in this switch's field-argument specifies which attributes of the format set by the \l switch are to be applied to the table. If the \l switch is blank, the \b switch value shall be 16 (AutoFit). text can have a value that is the bitwise-or of any combination of the following:

0, None

1, Borders

2, Shading

4, Font

8, Color

16, AutoFit

32, Heading Rows

64, Last Row

128, First Column

256, Last Column

\c field-argument

The text in this switch's field-argument specifies a connection to the data.

\d field-argument

The text in this switch's field-argument specifies the complete path and file name of the database. Used for all database queries except a query to an SQL database table using ODBC.

\f field-argument

The text in this switch's field-argument specifies the integral record number of the first data record to insert

\h

Inserts the field names from the database as column headings in the resulting table.

\l field-argument

The text in this switch's field-argument specifies the format that is to be applied to the result of the database query. If this switch is used and the \b switch doesn't specify the table attributes, an unformatted table is inserted.

\o field-argument

Inserts data at the beginning of a merge. By adding the \o switch to the database field, it will only get the data for the database field at the beginning of a merge instead of once for each record merged.  This is a performance optimization and should only be used when the database field doesn't rely on record specific information to gather.

\s field-argument

The text in this switch's field-argument specifies a set of SQL instructions. Each quotation mark in the instructions shall be preceded by a backslash (\).

\t field-argument

The text in this switch's field-argument specifies the integral record number of the last data record to insert.

example:

{ DATABASE \d "C:\\Data\\Sales93.mdb" \c "DSN=MS Access Database; DBQ=C:\\Data\\Sales93.mdb; FIL=RedISAM" \s "select * from \"Customer List\"" \f "2445" \t "2486" \l "2"