Redirect Results to a File
Redirect the result of one or more SAP HANA HDBSQL commands to a file.
Prerequisites
Procedure
Example
To export a list of all schemas and all entries in the table HOTEL.CUSTOMER to an external file, perform the following steps.
-
Log onto the SAP HANA database as user MONA with the password RED by running the following command:
hdbsql -n localhost -i 1 -u MONA, RED
-
Create the file c:\tmp\redirected.txt then redirect the command result(s) to this file by running the following command:
\o c:\tmp\redirected.txt - Request information about all schemas by running the following command: \ds
-
Select all rows in the table HOTEL.CUSTOMER by executing the following statement:
SELECT * FROM HOTEL.CUSTOMER
- Stop redirection to the file by running \o.
The redirected.txt file now contains the following content:
| Schema | Owner name | | ------ | --------------- | | MDX_TE | SYSTEM | | SECURI | SECURITY1 | | SOP_PL | SYSTEM | | SYS | SYS | | SYSTEM | SYSTEM | | _SYS_B | _SYS_REPO | | _SYS_B | _SYS_REPO | | _SYS_R | _SYS_REPO | | _SYS_S | _SYS_STATISTICS | | 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|