cancel
Showing results for 
Search instead for 
Did you mean: 

Remark in a SQL script run by hdbsql client

0 Kudos

How does one write a remark in SQL scripts being run by hdbsql client ?

I tried using the conventional "--" but it fails on the following error

257:sql syntax error: invalid SQL type  SQLSTATE:HY000

Accepted Solutions (0)

Answers (1)

Answers (1)

lbreddemann
Active Contributor
0 Kudos

Which version of hdbsql are you using?

I couldn't reproduce this with Rev. 84 on MS Windows.

c:\temp\comment.sql

select * from dummy;

-- some silly comments

select 'after the comment' from dummy;

hdbsql -U <ke> -I c:\temp\comment.sql

DUMMY

"X"

'after the comment'

"after the comment"

- Lars

0 Kudos

compversion-id: 01200615320200017866 comptype: HDB_CLIENT keyname: HDB_CLIENT keycaption: SAP HANA CLIENT keyvendor: sap.com release: 1.00 rev-number: 48 rev-changelist: 372847 sp-number: 48 sp-patchlevel: 48 makeid: 943465 date: 2013-01-13 12:06:52 platform: NTamd64 fullversion: 1.00.48 Build 0372847-1510 auxversion: 0000.00.0 changeinfo: P4 372847 (NewDB100_REL) compiletype: opt compilebranch: NewDB100_REL sapexe-version: 720 sapexe-branch: 720_EXT_REL sapexe-changelist: 1330613

lbreddemann
Active Contributor
0 Kudos

Rev. 48? Please, get a current client and try again. Rev.48 is nearly two years ago...

GS
Employee
Employee
0 Kudos

Hi Lars,

If the script ends with commented line then error comes up.

Is there any workaround for that?

for eg:

condition 1 :

---------------------

script1.sql

select * from dummy;

-- some silly comments

-- select 'after the comment' from dummy;

indxxxxxx:/usr/sap/xxx/HDB00> hdbsql -n infgfgfg2:30015 -i 00 -u SYSTEM -p manager -I script1.sql

* 257: sql syntax error: invalid SQL type SQLSTATE: HY000

GS
Employee
Employee
0 Kudos

ok, I found a workaround ..

Don’t use colon (;) from last valid query then It will work irrespective of comments we pass in next lines.

incorrect statement:

select user() from dummy;
-- dummy
/* dummy */
-- select user() from dummy;

run result: (error found)

CURRENT_USER

"SYSTEM"

1 row selected (overall time 1451 usec; server time 234 usec)

* 257: sql syntax error: invalid SQL type SQLSTATE: HY000

correct statement, gives no error:


select user() from dummy
-- dummy
/* dummy */
-- select user() from dummy;

run result: (successful)

CURRENT_USER

"SYSTEM"

lbreddemann
Active Contributor
0 Kudos

Hi Gaurav,

I consider this behavior a bug and you should open a support incident for it.

- Lars