Fields Tab

How to Access

  • Main Menu | Tools | Generate Scripts | SQL Script for Creating Table Fields tab.

GenerateScript_FieldsTab.png

The Fields tab lists all fields in the data file and allows you to set attributes that affect the way these fields are created on the SQL back-end. The Fields tab contains a grid with the following columns:

  • #: Column number (read-only).

  • Name: Field/column name (read-only).

  • Type: Structural type assigned to the field by DataFlex. There are two scenarios in DataFlex where the overlap field type is used. One is to concatenate several fields and consider them as one field. The other is to create a field from a subset of a field. The driver treats the first scenario logically and it functions similarly to how native DataFlex treats an overlap. When an overlap field is selected as part of an index to an SQL Table, it may not be created due to the number of segments the index is composed of. These are SQL limitations. Partial overlap (underlaps) fields are created as a native column only if the field is part of an index, otherwise it is treated the same as the first scenario.

  • Length: Field length in bytes. Position the cursor on a field length, then click the Length column header to display the Field Changes dialog.

  • Native Type: This is the data type that will be used for this field on the SQL back-end. Choose the desired type using the drop-down list or click the column header to show the Native Type Dialog. Note: Default field mappings can be made in the Tools > Preferences > Field Mappings tab.

  • AutoInc: Used to select the auto-increment field. RECNUM is the default auto-increment field.

  • Index: Main index associated to a field. Position the cursor on a field index, then click the Index column header to display the Field Changes dialog.

  • not NULL: Indicates whether or a null value is allowed in this field. Leave this option unchecked if null values are allowed. SQL databases require that fields specified as NOT NULL are given a value during an insert. The driver automatically inserts a default value if a value is not specified. Fields that are part of an index are always created as not NULL, and Flex2SQL does not allow you to change this because it directly affects FIND performance using indexes based on those fields. You can enter a default value in the panel on the right side of the screen, or by positioning the cursor on a not Null value, and clicking the column header to display the Field Changes Pop-up.

The Fields tab also contains a panel on the right side of the screen that allows you to enter additional information for the selected field.

  • Default: The default value that will be assigned to a not NULL field. Pressing the ellipsis (…) shows the Field Changes dialog dialog. Note: Global settings for the default values for not NULL field types are made in the Migration Options Tab Tab.

  • Relates To: The file and field from a parent table that this field is related to.

  • Mask: Special data mask applied to the field. Pressing the ellipsis (…) shows the Field Changes dialog dialog.

  • Check Constraint: Allows you to specify the name of a constraint that you may have defined for a particular field in the target/destination server.

  • Inverse Key: Field name used for the Inverse key.

  • Collation: Allows you to set the collation for string fields. Pressing the ellipsis (…) shows the Collation Dialog. Note: This is only enabled for string fields in a table that resides on an MS SQL server. This will be greyed out for all other field types and server back ends.

Bottom Controls

The controls at the bottom of the dialog remain the same regardless of the tab selected.

What to do radio buttons

There are 3 options:

  • Create Table and index: This will generate a script that can be used to create the tables and the indexes from the selected .Dat file(s) onto the selected backend.

  • Create Table Only: This will generate a script that can be used to generate the create the table(s) from the selected .Dat file(s) onto the selected backend.

  • Create Indexes Only: This will generate a script that can be used to create the indexes from the selected .Dat file(s) on the seleted backend.

The Buttons

  • Preferences: Shows the Preferences dialog.

  • SaveSet: Shows the Save the files to save as a set dialog.

  • Generate All: Generates the scripts for all the tables selected in Filelist dialog based on the radio button selected in What to do radio buttons.

  • Convert: Generates script for the only the table in the Table Name form based on the radio button selected in What to do radio buttons.

  • Help: Shows the help page of the selected tab.

  • Cancel: Closes the dialog.