Entering content frame

Procedure documentation Exporting a Result to a File Locate the document in its SAP Library structure

Use

You enter an SQL statement and export the result to a file.

Prerequisites

You have logged on to a database instance (Page 4).

Procedure

...

       1.      Enter the following command:

\o <file>

<file> = file to which the data is to be exported (with complete path)

       2.      Use SQL statements to select the data that is to be exported.

To enter several SQL in succession, choose Enter after each SQL statement.

       3.      To exit the export procedure, enter the exit command.

Example

Logging on to the database instance HOTELDB as user MONA with the password RED:

sqlcli -d HOTELDB -u MONA, RED

Generating the c:\tmp\customer.txt file to which the data is to be exported:

\o c:\tmp\customer.txt

Entering SQL statements:

select * from CUSTOMER <Enter>

select * from CITY

Exiting the export procedure:

exit

The customer.txt file now contains the following data:

| CNO    | TITLE   | FIRSTNAME  | NAME       | ZIP   | ADDRESS|
| ------ | ------- | ---------- | ---------- | ----- | -------|
|   3200 | Company | ?          | Datasoft   | 90018 | 486 Maple Str.|
|   3400 | Mrs     | Mary       | Griffith   | 20005 | 3401 Elder Lane|
|   3500 | Mr      | Martin     | Randolph   | 60615 | 340 MAIN STREET, #7|
|   3600 | Mrs     | Sally      | Smith      | 75243 | 250 Curtis Street|
|   3700 | Mr      | Mike       | Jackson    | 45211 | 133 BROADWAY APT. 1|
|   3900 | Mr      | George     | Howe       | 75243 | 111 B Parkway, #23|
|   4000 | Mr      | Frank      | Miller     | 95054 | 27 5th Str., 76|
|   4400 | Mr      | Antony     | Jenkins    | 20903 | 55 A Parkway, #15|

 

| ZIP   | NAME                 | STATE |
| ----- | -------------------- | ----- |
| 10017 | New York             | NY    |
| 10018 | New York             | NY    |
| 10019 | New York             | NY    |

 

Leaving content frame