For advanced users: Changing the database structure

<< Click to Display Table of Contents >>

For advanced users: Changing the database structure

This section is for advanced users. In general, it is unnecessary to adjust the data structure of existing databases.

For more information on how to create a completely new database, see Creating a new database. You can also use TextMaker to change the structure of an existing SQLite or dBASE database – for example, add/delete fields or change the properties of fields (name, type, length, etc.).

To do so, proceed as follows:

1.It is always a good idea to create a backup copy of your database before making changes to its structure.
2.Open the desired database with the command Edit database db_edit_icon, as described in Opening a database. The database module appears.
3.In the database module in the group Manage, choose the command Change structure db_modify_structure_icon.
4.The program displays a dialog box that corresponds to that of the command Create database (see Creating a new database) and presents all fields in the database. Make the desired changes to the database structure in the dialog box. For more information, see below.
5.When you are finished, click on the Save button. Use the Cancel button to discard your entries.

Note: If you save your entries in this dialog box by choosing Save, the existing database is overwritten.

Your changes will now be applied. You can now close the database module or, if necessary, perform further steps on the open database in the database module.

Tip: We recommend that you open the resulting database briefly after closing it and check the result. Whenever you apply a huge number of changes of all types to a database at once, the contents of certain fields may not be transferred. In that rare case, restore the backup copy of your database and apply your changes once more – but this time, do this in multiple steps instead of performing all changes at once.

Using the "Change database structure" dialog box for SQLite

Tip: A list of all available field types and with their properties can be found in Creating a new SQLite database.

The aforementioned dialog box of the command Change structure db_modify_structure_icon can be used as follows:

Inserting a new field

To insert a new field, enter a unique name for the field under Name and choose a suitable field type for Type.
Once you have entered all relevant information for a field, click on Append to add the new field after the last field. Alternatively, click on Insert to insert the field above the current field.

Changing a field

To change the properties of a field (name, type, length, etc.), click on the relevant field in the list Fields, and its properties will be applied to the controls at the bottom of the dialog box. Make the desired changes there and then click on Replace.

Deleting a field

To delete a field, select it in the list Fields and click on Delete.

Note on the command "Table settings" (available for SQLite only):

In the database module, the group Manage also contains the command Table settings db_table_settings_icon. In the dialog box of this command, you only change the display of the relevant field type for an SQLite database. Here, you only determine the way in which fields are displayed, but you do not change the actual database structure. This is useful if the database was created in another program with different field types.

For more information on the field types, see Creating a new SQLite database.

Using the "Change database structure" dialog box for dBASE

Tip: A list of all available field types, together with their properties, can be found in Creating a new dBASE database.

The aforementioned dialog box of the command Change structure db_modify_structure_icon can be used as follows:

Inserting a new field

To insert a new field, enter a unique name for the field under Name and choose a suitable field type for Type. If necessary, enter the desired Length and the number of decimal places for Dec..
Once you have entered all relevant information for a field, click on Append to add the new field after the last field. Alternatively, click on Insert to insert the field above the current field.
Note: A database can contain a maximum of 254 fields, but the total length of all fields cannot exceed 4000.

Changing a field

To change the properties of a field (name, type, length, etc.), click on the relevant field in the list Fields, and its properties will be applied to the controls at the bottom of the dialog box. Make the desired changes there and then click on Replace.

Deleting a field

To delete a field, select it in the list Fields and click on Delete.