on 12-02-2014 7:22 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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"
User | Count |
---|---|
77 | |
9 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.