on 10-02-2015 5:20 AM
Hello Experts,
I have created a table T1 with four fields. I want to add additional column to this table say C1 that contains the system username by default.
For this I wrote an ALTER TABLE statement as - alter table "SCHEMA"."ZDB_TEST2" add (created_by varchar(20) default system_user);
But I am getting syntax error in this case. Please guide me in order to resolve this.
Thanks in advance,
Dnyanesh
Hello Dnyanesh,
a function "system_user" does not exist, therefore you are getting the syntax error.
But independent of that to my knowledge up to now no option exists to use e.g. function CURRENT_USER in a CREATE or ALTER statement. According to the documentation just some date/time value functions are supported beside string and numeric literals.
ALTER TABLE - SAP HANA SQL and System Views Reference - SAP Library
<default_value_clause> ::= DEFAULT <default_value_exp>
<default_value_exp> ::= NULL | <string_literal> | <signed_numeric_literal> | <unsigned_numeric_literal> | <datetime_value_function>
<datetime_value_function> ::= CURRENT_DATE | CURRENT_TIME | CURRENT_TIMESTAMP | CURRENT_UTCDATE | CURRENT_UTCTIME | CURRENT_UTCTIMESTAMP
Best Regards,
Florian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.