|
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
Type the name for new table, which can be a maximum of 20 bytes.
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, or click
.
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 icon. When no more actions are available for undo or redo, the icon 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 in 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
See also Naming Conventions in Pervasive PSQL Programmer's Guide, which is part of the Pervasive PSQL Software Developer's Kit (SDK).
The name can be alpha-numeric, 20 bytes or less. The name can have spaces, but spaces in column names are discouraged. Also, as a general rule, avoid using reserved words for column names. See Reserved Words 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. To use this file, you would type c:\pvsw\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 insert an index
Only the database management system (DBMS) 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 name is restricted to a maximum length of 20 bytes.
Note that a name used for an index cannot be used for a foreign key, and vice versa.
The new index appears in the Indexes list.
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 management system (DBMS) 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 management system (DBMS) 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 management system (DBMS) 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.
).

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 prefer descending, click in the "Sort Order" column then click Descending in the sort list.
Note that a column can be selected as an index only once. Once selected, the column is removed from the list of choices. For example, suppose in the image above that you were to click on "Log" as an index column. You would have two index segments: "Student_ID" and "Log." If you wanted to add a third index segment, "Student_ID" and "Log" do not appear in the list of possible columns because they have already been designated as indexes.
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 management system (DBMS) 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.
).

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 prefer descending, click in the "Sort Order" column then click Descending in the sort list.
Note that a column can be selected as an index only once. Once selected, the column is removed from the list of choices. For example, suppose in the image above that you were to click on "Log" as an index column. You would have two index segments: "Student_ID" and "Log." If you wanted a third index segment, "Student_ID" and "Log" do not appear in the list of possible columns because they have already been designated as indexes.
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.
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.
A check mark in the box indicates that the index allows duplicates (the values are not unique).
Lack of a check mark indicates that the index values are unique (duplicate values are not allowed).
The default for all SQL data types is that the index column allows 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.
The name is restricted to a maximum length of 20 bytes.
Note that a name used for a foreign key cannot be used for an index, and vice versa.
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
The Index Segment Details displays.
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: GUI Visual Reference
|