Using Caché SQL
Importing and Exporting SQL Data
[Back] 
   
Server:docs2
Instance:LATEST
User:UnknownUser
 
-
Search:    

In the Management Portal, there are tools for importing and exporting data:

These tools use Dynamic SQL, which means that queries are prepared and executed at runtime. By default, the maximum size of a row that can be imported or exported is 32,767 characters. This limitation can be greatly expanded by configuring long string operations.
You can also import data using the %SQL.Import.Mgr class, and export data using the %SQL.Export.Mgr class.
Importing Data from a Text File
You can import data from a text file into a suitable Caché class. When you do so, Caché creates and saves new rows in the table for that class. The class must already exist and must be compiled. To import data into this class:
  1. From the Management Portal select System Explorer, then SQL ([Home] > [SQL]). Select a namespace with the Switch option at the top of the page; this displays the list of available namespaces.
  2. At the top of the page, click the Wizards drop-down list, and select Data Import.
  3. On the first page of the wizard, start by specifying the location of the external file. For The import file resides on, click the name of the server to use.
  4. Then enter the complete path and filename of the file.
  5. For Select schema name, click the Caché package into which you want to import the data.
  6. For Select table name, click the class that will contain the newly created objects.
  7. Then click Next.
  8. On the second page of the wizard, click the columns that will contain the imported data.
  9. Then click Next.
  10. On the third page of the wizard, describe the format of the external file.
  11. Click Next.
  12. Review your entries and click Finish. The wizard displays the Data Import Result dialog box.
  13. Click Close. Or click the given link to view the background tasks page.
    In either case, the wizard starts a background task to do the work.
Exporting Data to a Text File
You can export data for a given class to a text file. To do so:
  1. From the Management Portal select System Explorer, then SQL ([Home] > [SQL]). Select a namespace with the Switch option at the top of the page; this displays the list of available namespaces.
  2. At the top of the page, click the Wizards drop-down list, and select Data Export.
  3. On the first page of the wizard, enter the complete path and filename of the file that you are going to create.
  4. For Select schema name, click the Caché package from which you want to export the data.
  5. For Select table name, click the class from which you want to export the data.
  6. Then click Next.
  7. On the second page of the wizard, click the columns to export.
  8. Then click Next.
  9. On the third page of the wizard, describe the format of the external file.
  10. Click Next.
  11. Review your entries and click Finish. The wizard displays the Data Export Result dialog box.
  12. Click Close. Or click the given link to view the background tasks page.
    In either case, the wizard starts a background task to do the work.