|
<< Click to Display Table of Contents >> Redefining a Table |
![]() ![]()
|
As PdxEditor does not provide altering fields on a visual field level, this is done through redefining tables via SQL.
If you for example have an old Paradox table as the EMPLOYEE.DB from the 1995 Borland DBDemos database as specified by the following fields:

EMPLOYEE.DB with Paradox Native field types

EMPLOYEE.DB with the same fields displayed with their Generic field types
and you want to reformat the EmpNo field from Integer into a SmallInt field and the HireDate field from TimeStamp into a Date field, this is done through re-building the table using a modified SQL definition of the existing table, and with successive transferring of the original data with the appropriate reformatting of the fields (using SQL CAST(field AS FieldType) as desired with code as follows:
CREATE TABLE Employee2 (
EmpNo SmallInt
, LastName VARCHAR(20)
, FirstName VARCHAR(15)
, PhoneExt VARCHAR(4)
, HireDate DATE
, Salary FLOAT
, PRIMARY KEY ("employee"."EmpNo")
);
INSERT INTO Employee2
(EmpNo, LastName, FirstName, PhoneExt, HireDate, Salary)
SELECT
CAST(EmpNo AS SmallInt)
, LastName
, FirstName
, PhoneExt
, CAST(HireDate AS DATE)
, Salary
FROM EMPLOYEE;
CREATE INDEX ByName ON Employee2 (LastName, FirstName);
giving these newly defined native fields (EmpNo and HireDate):

Employee2 reformatted Paradox table Native field types

Employee2 reformatted Paradox table Generic field fypes
Reformatting fields using SQL CAST( ) may also be used solving issues with transferring data between various table levels, especially concerning the various dBASE numeric field types.
See also Save query result as table, Autoinc/Primary Key fields and dBASE: Reverse CREATE modes.
__________________________