SQL Subcommand (SAVE TRANSLATE command)

The SQL subcommand provides the ability to issue any SQL directives that are needed in the target database. It can be used, for example, to define joins or alter table properties in the database to include new columns or modify column properties.

Example: Adding New Columns to an Existing Table

SAVE TRANSLATE /TYPE=ODBC
 /CONNECT=
 'DSN=MS Access Database;DBQ=C:\examples\data\dm_demo.mdb;'
 'DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;'
  /TABLE = 'NewColumn'
  /KEEP ID income_score
  /REPLACE 
  /SQL='ALTER TABLE CombinedTable ADD COLUMN income_score REAL'
  /SQL='UPDATE CombinedTable INNER JOIN NewColumn ON ' +
  'CombinedTable.ID=NewColumn.ID SET ' +
  'CombinedTable.income_score=NewColumn.income_score'.

The end result is that an existing table is modified to include a new column containing the values of the computed variable.

Example: Specifying Data Types for a New Table

SAVE TRANSLATE /TYPE=ODBC
  /CONNECT='DSN=MS Access Database;DBQ=c:\temp\temp.mdb;DriverId=25;FIL=MS'+
  ' Access;MaxBufferSize=2048;PageTimeout=5;'
  /TABLE=tempTable    /REPLACE
  /SQL='CREATE TABLE NewTable(numVar double, intVar integer, dollarVar currency)'
  /SQL='INSERT INTO NewTable(numVar, intVar, dollarVar) SELECT * FROM tempTable'
  /SQL='DROP TABLE tempTable'.