|
This section explains the tasks that you perform with Table Editor. The tasks are divided into the following categories:
|
Category
|
Description
|
|---|---|
|
Orient you to the overall use of Table Editor
|
|
|
Apply to using the Columns page
|
|
|
Apply to using the Indexes page
|
|
|
Apply to using the Statistic page
|
|
|
Apply to using the SQL View page
|
Note
You cannot save the changes to the structure of a table if any queries in SQL Editor are holding the table "open." Close the SQL Editor holding open the table then save the changes.
General tasks apply to the overall use of the tool.
Column tasks apply to the Columns page.
Index tasks apply to the Indexes page.
Foreign keys tasks apply to the Foreign Keys page.
SQL view tasks apply to the SQL View page.
To start Table Editor for a new table
Tip
For a list of database object lengths and invalid characters, see Identifier Restrictions by Identifier Type in Advanced Operations Guide.
To start Table Editor for an existing table
To work with columns
To work with indexes
To work with foreign keys
To view SQL statements applicable to the table
To view table data
If the Grid is empty but the table contains data, right-click on any row in the Grid then click Refresh.
Note that the Grid allows you to directly change database data by changing the values in the grid cells. See Grid Tasks .
To identify tables with changes that have not been saved
To save changes for the table being edited
Note that you cannot undo or redo changes to a table once the table has been saved.
To save changes for all tables being edited
Note that you cannot undo or redo changes to tables once the tables have been saved.
To undo changes or to redo changes
to undo an action; click
to redo an action.If multiple actions have occurred since the last save, you can repeatedly click the undo or redo toolbar buttons. When no more actions are available for undo or redo, the toolbar button becomes disabled.
Note that you cannot undo or redo changes to a table once the table has been saved.
To insert a column between existing columns
The new column appears above the existing column row. The default name of the inserted column is "columnn," where "n" is a number that automatically increments by one. (The first column you insert is column0, the second column1 and so forth.)
Tip
You can also insert a column by clicking on an existing column row, then pressing Ctrl+Insert or clicking. Repeating either action inserts a series of columns in succession.
To insert a column at the end
or
Click the "Column Name" cell on the empty column row below the last existing column row and start typing a name for the column.
The default name of the inserted column is "columnn," where "n" is a number that automatically increments by one. (The first column you insert is column0, the second column1 and so forth.)
Tip
You can also insert a column at the end by clickingor pressing Ctrl+Insert.
Repeating either action inserts a series of columns in succession. The insert action automatically adds the new column to the end.
To select a column or multiple columns
To select multiple columns, press and hold Shift or Ctrl then click
for the desired additional columns.
To delete a column
Tip
You can also delete a column by clicking on an existing column row, then pressing Ctrl+Delete or clicking.
You can also delete multiple columns by selecting multiple columns rows. See To select a column or multiple columns .
To specify a column name
Tip
For a list of database object lengths and invalid characters, see Identifier Restrictions by Identifier Type in Advanced Operations Guide.
Also, as a general rule, avoid using reserved words for column names. See Reserved Words in SQL Engine Reference. See also Versions of Metadata in SQL Engine Reference.
To set a column data type
The data in your database is converted if you change a column data type. For a listing of data types, see Pervasive PSQL Supported Data Types in SQL Engine Reference.
Changing a column data type sets the defaults for that type on the following: size, scale, precision, default, and collate.
).
To set a column size
Data in your database is truncated if you change the column to a smaller size for the following data types:
You can set a size only for applicable data types, such as CHAR. If size is not applicable, the grid cell is shaded and you will be unable to edit the Size.
To set column precision
Precision specifies the number of significant digits for floating point values.
You can set precision only for applicable data types, such as DECIMAL. If precision is not applicable, the grid cell is shaded and you will be unable to edit the Precision.
To set a column scale
Scale specifies the number of significant digits that are to the right of the decimal point for floating point values.
You can set a scale value only for applicable data types, such as NUMERIC. If scale is not applicable, the grid cell is shaded and you will be unable to edit the Scale.
To set a column to allow or disallow nulls
For additional information about nulls, see Rebuild Utility Concepts in Advanced Operations Guide, INSERT in SQL Engine Reference, and Null Value in the Pervasive PSQL Programmer's Guide, which is part of the Pervasive PSQL Software Developer's Kit (SDK).
You can allow nulls only for applicable data types. A shaded square indicates that null values do not apply to the data type.
Also see Null Values .
To set case sensitivity for a column
Case sensitivity does not apply if the key uses an alternate collating sequence (ACS). You cannot specify case sensitivity and use an ACS.
You can set a collating sequence only for applicable data types. A shaded square indicates that case sensitivity does not apply to the data type.
By default, Pervasive PSQL is case sensitive when sorting string keys. Uppercase letters are sorted before lowercase letters. If you specify case insensitive, values are sorted without distinguishing case.
To set a column collating sequence
For additional information about collating sequences, see Manipulating Btrieve Data Files with Maintenance in Advanced Operations Guide and Alternate Collating Sequences in the Pervasive PSQL Programmer's Guide, which is part of the Pervasive PSQL Software Developer's Kit (SDK).
If you use an alternate collating sequence (ACS), you cannot specify case sensitivity. Case sensitivity does not apply if the key uses an ACS.
You can set an alternating collating sequence (ACS) only for applicable data types. If collating sequence is not applicable, the grid cell is shaded and you will be unable to edit the Collate cell.
Pervasive PSQL supplies an ACS file, upper.alt, in the Samples folder. (See Where are the Pervasive PSQL v10 files installed? in Getting Started With Pervasive PSQL.) To use this file, you would type file_path\PSQL\samples\upper.alt.
Upper.alt treats upper and lower case letters the same for sorting. For example, if a database has values abc, ABC, DEF, and Def, inserted in that order, the sorting with upper.alt returns as abc, ABC, DEF, and Def. (The values abc and ABC, and the values DEF and Def are considered duplicates and are returned in the order in which they were inserted.) Normal ASCII sorting sequences upper case letters before lower case, such that the sorting would return as ABC, DEF, Def, abc.
To set a column default
The default value is used if you perform an SQL INSERT for a row but do not provide a value for the column.
You can set a default only for applicable data types. If a default is not applicable, the grid cell is shaded and you will be unable to edit the Default.
The column default can be a scalar function for certain data types:
|
Data Type
|
Scalar Function1
|
|---|---|
|
Date
|
|
|
Time
|
|
|
Timestamp
|
See also NOW ( ) in SQL Engine Reference.
|
|
1 The names are case insensitive. NOW() and now() are equivalent. The parentheses are required. That is, NOW is invalid but NOW() is valid.
|
|
To set or remove a column as a primary key
Note that you cannot set a primary key on a column that allows NULLs.
To select multiple columns, press and hold Shift or Ctrl then click
for the desired additional columns.
If the column(s) is not a primary key, the action sets the column(s) as a primary key.
If the column, or if any of the columns when multiple columns are selected, is already a primary key, the action removes the setting from all columns.
For example, suppose that column 1 is a primary key and you want columns 1, 2, and 3 to be the primary key. You press and hold Ctrl then click columns 1, 2, and 3. When you click the primary key icon, it is removed from column 1 but not added to columns 2 and 3. If you click the primary key icon again, then columns 1, 2, and 3 are designated as primary keys.
To create an index
Only the database engine can add an index to an IDENTITY or SMALLIDENTITY column. However, you can include an IDENTITY or SMALLIDENTITY column as part of a multiple-segment index.
Table Editor permits you to include an IDENTITY or a SMALLIDENTITY column in the Indexes list if you have not saved the table. However, the DBMS returns an error when you attempt to save the table. After you delete the IDENTITY or SMALLIDENTITY column from the list, you may then save the table.
The New Index dialog displays.
Tip
For a list of database object lengths and invalid characters, see Identifier Restrictions by Identifier Type in Advanced Operations Guide.
The new index appears in the Indexes list and the Index Segment Details display. Note that the first column is populated into the Columns list.
Note
New indexes are created by default as Normal.

Caution
Indexes must have at least one Column designated. If you do not select a Column for the Index, the first column remains selected.
The default sort order is Ascending. If you need a descending sort order, select Descending from the Sort Order list for the Column you want changed.
Note
Some data types, such as LONGVARBINARY, cannot be used for an index. Columns with such data types are not valid choices.
Note that a column can be selected for an index only once. Once selected, the column is removed from the list of choices because the column has already been designated in the index.
See also Creating Indexes in Pervasive PSQL Programmer's Guide, which is part of the Pervasive PSQL Software Developer's Kit (SDK).
To create a unique index
Only the database engine can add an index to an IDENTITY or SMALLIDENTITY column. However, you can include an IDENTITY or SMALLIDENTITY column as part of a multiple-segment index.
Table Editor permits you to include an IDENTITY or a SMALLIDENTITY column in the Indexes list if you have not saved the table. However, the DBMS returns an error when you attempt to save the table. After you delete the IDENTITY or SMALLIDENTITY column from the list, you may then save the table.
The New Index dialog displays.
Tip
For a list of database object lengths and invalid characters, see Identifier Restrictions by Identifier Type in Advanced Operations Guide.
The new index appears in the Indexes list and the Index Segment Details display.
Note
New indexes are created by default as Normal.
Caution
Indexes must have at least one Column designated. If you do not select a Column for the Index, the first column remains selected.
The default sort order is Ascending. If you need a descending sort order, select Descending from the Sort Order list for the Column you want changed.
Note
Some data types, such as LONGVARBINARY, cannot be used for an index. Columns with such data types are not valid choices.
Note that a column can be selected for an index only once. Once selected, the column is removed from the list of choices because the column has already been designated in the index.
See also Creating Indexes in Pervasive PSQL Programmer's Guide, which is part of the Pervasive PSQL Software Developer's Kit (SDK).
To create a partial index
Only the database engine can add an index to an IDENTITY or SMALLIDENTITY column. However, you can include an IDENTITY or SMALLIDENTITY column as part of a multiple-segment index.
Table Editor permits you to include an IDENTITY or a SMALLIDENTITY column in the Indexes list if you have not saved the table. However, the DBMS returns an error when you attempt to save the table. After you delete the IDENTITY or SMALLIDENTITY column from the list, you may then save the table.
The New Index dialog displays.
Tip
For a list of database object lengths and invalid characters, see Identifier Restrictions by Identifier Type in Advanced Operations Guide.
The new index appears in the Indexes list and the Index Segment Details display.
Note
New indexes are created by default as Normal.
Caution
Indexes must have at least one Column designated. If you do not select a Column for the Index, the first column remains selected.
The default sort order is Ascending. If you need a descending sort order, select Descending from the Sort Order list for the Column you want changed.
Note
Partial Indexes are restricted to columns with a data type of CHAR or VARCHAR and that are designated as the only or last segment in an Index.
Note that a column can be selected for an index only once. Once selected, the column is removed from the list of choices because the column has already been designated in the index.
See also Creating Indexes in Pervasive PSQL Programmer's Guide, which is part of the Pervasive PSQL Software Developer's Kit (SDK).
To modify an existing index
The database engine creates some indexes, such as IDENTITY column indexes and primary key indexes. These indexes are read-only and cannot be modified.
Table Editor permits you to include an IDENTITY or a SMALLIDENTITY column in the Indexes list if you have not saved the table. However, the DBMS returns an error when you attempt to save the table. After you delete the IDENTITY or SMALLIDENTITY column from the list, you may then save the table.
The Index Segment Details displays.
To delete an index
The database engine creates some indexes, such as IDENTITY column indexes and primary key indexes. These indexes are read-only and cannot be deleted.

To insert an index segment
For detailed information about segments, see Segmentation in the Pervasive PSQL Programmer's Guide, which is part of the Pervasive PSQL Software Developer's Kit (SDK).
Only the database engine can add an index to an IDENTITY or a SMALLIDENTITY column. However, you can include an IDENTITY or a SMALLIDENTITY column as part of a multiple-segment index. See also AUTOINC in SQL Engine Reference.
The Index Segment Details displays and lists the selected Index Segments.
).

Note
Some data types, such as LONGVARBINARY, cannot be used for an index. Columns with such data types are not valid choices.
The default sort order is Ascending. If you need a descending sort order, select Descending from the Sort Order list for the Column you want changed.
Note that a column can be selected for an index only once. Once selected, the column is removed from the list of choices because the column has already been designated in the index.
To modify an index segment
For detailed information about segments, see Segmentation in the Pervasive PSQL Programmer's Guide, which is part of the Pervasive PSQL Software Developer's Kit (SDK).
Only the database engine can add an index to an IDENTITY or a SMALLIDENTITY column. However, you can include an IDENTITY or a SMALLIDENTITY column as part of a multiple-segment index. See also AUTOINC in SQL Engine Reference.
The Index Segment Details displays.
).

Note
Some data types, such as LONGVARBINARY, cannot be used for an index. Columns with such data types are not valid choices.
The default sort order is Ascending. If you need a descending sort order, select Descending from the Sort Order list for the Column you want changed.
Note that a column can be selected for an index only once. Once selected, the column is removed from the list of choices because the column has already been designated in the index.
To delete an index segment
Note
Each index requires a minimum of one segment. To delete an index that has only one segment, delete the index itself.
The Index Segment Details displays, listing all the designated index segments.

To arrange the order of index segments
The Index Segment Details displays.
To specify a sort order for an index
For detailed information about sort order, see Sort Order in the Pervasive PSQL Programmer's Guide, which is part of the Pervasive PSQL Software Developer's Kit (SDK).
The Index Segment Details displays.
).The default sort order when an index segment is created is ascending.
To allow duplicates in an index
For detailed information about duplicates, see Duplicatability in the Pervasive PSQL Programmer's Guide, which is part of the Pervasive PSQL Software Developer's Kit (SDK).
The Index Segment Details displays.
Note
By default, indexes are created as Normal, allowing duplicates.
To specify index as modifiable
For detailed information about modifiability, see Modifiability in the Pervasive PSQL Programmer's Guide, which is part of the Pervasive PSQL Software Developer's Kit (SDK).
The Index Segment Details displays.

A check mark in the box indicates that the index value can be modified. Lack of a check mark indicates that the index value cannot be modified.
The default for all SQL data types is that the index column is modifiable.
To add a foreign key
Note that at least one table in the database must have a primary key or you cannot add a foreign key.
Tip
For a list of database object lengths and invalid characters, see Identifier Restrictions by Identifier Type in Advanced Operations Guide.
The new foreign key appears in the Foreign Keys list and the Foreign Keys Details display.

for "Select Primary Table" to display the list of tables permissible as primary tables.

The primary field(s) in the table appear in "Primary Table Fields" column.

Click the empty cell in the "Foreign Table Fields" column for the corresponding field in the "Primary Table Fields," then click
to displays the list of permissible fields.

Note
The data type and size of the fields must match. The list of Foreign Table Fields contains only fields that are the same data type and size as the primary table field being matched.
Pervasive PSQL allows a circular delete cascade on a table that references itself. Because of this, use delete cascade with caution. See Delete Restrict and Delete Cascade , both in Advanced Operations Guide.
To modify a foreign key
See steps 5 through 10 in To add a foreign key .
To delete a foreign key
To copy SQL statements
Tip
You can press Ctrl+A to select all of the text.
To maximize or restore view of SQL statements
|
Chapter contents
Prev topic: Table Editor GUI Visual Reference
|