To use the sp_AddTableToDatabase you must specify the following; Table Name, Table Path, Table Type, Character Type, Index File(s) and Comments. The table path can be a UNC path or relative path to the dictionary, however, the table must be on the same drive as the database otherwise a 7041 error will occur. The table type is specified as an integer value: 1 DBF/NTX, 2 DBF/CDX, 3 ADT and 4 VFP. Likewise the character types are 1 ANSI and 2 OEM, however this setting will be overridden if a dynamic collation has been specified.
The following statement adds the Department table to the data dictionary specified on the current connection.
EXECUTE PROCEDURE sp_AddTableToDatabase( 'Department', 'C:\Data\Department.adt', 3, 1, NULL, 'Test of sp_AddTableToDatabase' )
The AdsDDAddTable API takes a connection handle to a data dictionary and then the same parameters as the system procedure.You must connect to the data dictionary with a user who has the right to Create tables in the dictionary in order to use either of these functions.