cancel
Showing results for 
Search instead for 
Did you mean: 

hdbsql - inline command to import database

chladek
Participant
0 Kudos

Hello,
I would like to use bash script where beside other commands I have:

inline command:
./hdbsql -n localhost -u MYUSER -p <mypass> "IMPORT "SBODEMOCZ"."*" AS BINARY FROM '/mypath/SBODEMOCZ' WITH IGNORE EXISTING;"

but it returns:
* 257: sql syntax error: incorrect syntax near "*": line 1 col 18 (at pos 18) SQLSTATE: HY000

When I firstly login into hdbsql console:
./hdbsql -n localhost -u MYUSER -p <mypass>

then pass the command:
hdbsql NDB=>IMPORT "SBODEMOCZ"."*" AS BINARY FROM '/mypath/SBODEMOCZ' WITH IGNORE EXISTING;

it works properly.
Please how can I do it as inline command?

Thank You
Regards
Zdenek

View Entire Topic
mamartins
Active Contributor

You need to escape the " from the IMPORT command, otherwise the HDBSQL will interpret the second " as the end of the command.

Also, you could store the commands in a file and call the HDBSQL (option -I <file>) to execute them. Official documentation here.

Vitaliy-R
Developer Advocate
Developer Advocate
0 Kudos

I do not think escape matters (but maybe for the versions of hdbsql?) as I can execute on Mac's terminal following without the issues:

hdbsql -U TECHED_DEMO_VECTOR -j "SELECT "Current_User" FROM \"DUMMY\""

VitaliyR_0-1716221258303.png