The SAVE command enables committing the loaded TARGIT InMemory Database to the disk and also makes it possible to store a single InMemory table in the file system as either a compressed .targitdb file or as a CSV file.
Note: When building a tiImport script the last command must always SAVE command without any
parameters, otherwise the data processed until that point will be discarded.
Syntax:
SAVE [TABLE tablename TO {CSV} 'path_in_filesystem']
Example:
/* Connect to SQL Server */
DATASOURCE sqldb=SQLSERVER 'Server=localhost;Database=StageTCP;Trusted_Connection=True;'
/* Read all tables from the SQL database – SLURP only works on MS SQL, Access and TARGIT InMemory Database connections */
SLURP sqldb
/* Save a single table to a storage location in TARGITDB format, a valid path must be specified */
SAVE TABLE 'salestransactions' TO 'C:\OUTPUT\salestransactions.targitdb'
/* Save a single table as a CSV to a storage location, a valid path must be specified */
SAVE TABLE 'salestransactions' TO CSV 'C:\OUTPUT\salestransaction.csv'
/* Commit entire database to disk */
SAVE
Comments
Please sign in to leave a comment.