Prev | User's Guide | Next |
Table Designer Concepts
This section contains the following topics:
Overview
The Pervasive.SQL Table Designer allows you to add, delete, or change the characteristics of columns within a table. You may apply these changes only to the data definition files, files.ddf, field.ddf, and index.ddf, or also to the actual data in the data file (such as .mkd files). In addition, Table Designer allows you create a database or a table.
To create or modify a database with Table Designer, Btrieve database security must be turned off. In addition, you must have full administrator rights on the machine on which the database engine is running even if you are a member of the Pervasive_Admin group. See Database Security in Advanced Operations Guide for more about Btrieve database security and operating system access rights, and Granting Administrative Rights for the Database Engine .
Caution
Backup all your data definition files (DDFs) and data files before you perform functions through Table Designer. This tool gives you the ability to modify your database table definitions and data. If you inadvertently set the options incorrectly or enter incorrect data, you could change your files in an irreversible manner. Full recovery is possible if you have performed a backup.
Table Designer includes a graphical user interface (GUI) that runs only on Windows 32-bit platforms. See Table Designer GUI Visual Reference for an explanation of the objects on the GUI.
Tabbed Dialogs
Table Designer contains the following tabbed dialogs that you use as work areas:
You select a tabbed dialog by clicking on its tab.
Columns Tab
The Columns tab lets you add and modify columns when Table Designer is in linked mode. When Table Designer is in unlinked mode, the Columns tab is read-only. See Modes .
The information on the Columns tab directly corresponds to the information on the Btrieve tab. This correspondence lets you see the Btrieve equivalents on the Btrieve tab. The Btrieve tab appears when Table Designer is in unlinked mode.
See Columns Tab for a description of the areas on the Columns tab. See Columns Tasks for the tasks that you perform on the tab.
Indexes Tab
The Indexes tab lets you add and modify indexes and index segments. When Table Designer is in unlinked mode, the index changes affect only the data definitional files. See Modes .
See Indexes Tab for a description of the areas on the tab. See Indexes Tasks for the tasks that you perform on the tab.
Statistics Tab
The Statistics tab shows you information about the current table. You may modify the location of a table's data file on this tab. All other information on this tab is read-only.
See Statistics Tab for a description of the areas on the tab and Statistics Tasks for the tasks that you perform on the tab.
Btrieve Tab
The Btrieve tab displays data in a Btrieve file and lets you modify the data definition files. The Btrieve tab appears only if Table Designer is in unlinked mode. See Unlinked Mode .
The information on the Btrieve tab directly corresponds to the information on the Columns tab. This correspondence lets you see the SQL equivalents on the Columns tab. Note that when Table Designer is in unlinked mode-that is, when the Btrieve tab is available-the Columns tab is read-only.
See Btrieve Tab for a description of the areas on the tab. See Btrieve Tasks for the tasks that you perform on the tab.
Modes
Table Designer functions in one of two modes: linked or unlinked. The lower right corner of the main window indicates your current mode. Also note that all four tabbed dialogs appear only in the unlinked mode.
Figure 5-2 Mode IndicatorLinked Mode
When Table Designer is in linked mode, the changes you make are reflected in both the table definitions and the corresponding data files. That is, the changes are linked between the table definitions and the data. The changes affect files.ddf, field.ddf, and index.ddf, and data files such as .mkd files.
Linked mode is the default mode. In this mode, only the Columns tab, Indexes tab, and Statistics tab appear. Use this mode to design your table characteristics in terms of SQL access.
Unlinked Mode
When Table Designer is in unlinked mode, the changes you make are reflected only in the table definitions. The data files are not modified in any way. The changes are not linked between the table definitions and the data. The changes affect only data definition files such as file.ddf, field.ddf, and index.ddf.
In this mode, all four of the tabbed dialogs appear, but the Columns tab is read-only. Use this mode to modify table definitions to match existing data files. This mode also allows you to view the mappings between Btrieve data types and SQL data types. See Data Types .
Data Types
Refer to Pervasive.SQL Supported Data Types in SQL Engine Reference for a list of the data types supported by the database engine. That section lists the Pervasive.SQL data types for the transactional and relational interfaces and the equivalent ODBC data types. You may use any data types listed in Pervasive.SQL Supported Data Types and that appear in the "Type" selection list on the Columns tab or the Btrieve tab.
The following data types are supported by the relational interface as read-only data types. They cannot be created in an SQL statement.
Null Values
The ability to modify the null attribute of a column is subject to the following restrictions:
- The target column cannot have a PRIMARY/FOREIGN KEY constraint defined on it.
- If converting the old type to the new type causes an overflow (arithmetic or size), the ALTER TABLE operation is aborted.
- If a nullable column contains NULL values, the column cannot be changed to a non-nullable column.
If you must change the data type of a key column, you can do so by deleting the index key, changing the data type, and re-adding the key. Keep in mind that you must ensure that all associated index key columns in the database remain synchronized.
For example, if you have a primary index key in table T1 that is referenced by foreign keys in tables T2 and T3, you must first delete the foreign keys. Then you delete the primary key and change all three columns to the same data type. Finally, you must re-add the primary key and then the foreign keys.
For additional information on nulls, see the following:
- Rebuild Utility Concepts in Advanced Operations Guide
- INSERT in SQL Engine Reference
- Null Value in Pervasive.SQL Programmer's Guide, which is part of the Pervasive.SQL Software Developer's Kit (SDK).
Prev Table Designer |
Contents Up Check for Revisions | Next Table Designer GUI Visual Reference |