on 10-13-2016 8:24 AM
Hi, all.
My question is about sqlscript on SAP HANA.
I found an example of inserting to a table.
create table mytab (i int);
insert into mytab values (0);
insert into mytab values (1);
How to insert lines to my declare table variable, such as: declare mytab table (i int)?
Hello Alexander,
on table variables declared on SQLScript no Insert can be executed. Use a select to fill the table with the required values.
For instance:
declare mytab table (i int);
mytab = select 1 as i from dummy
union select 2 as i from dummy
union select 3 as i from dummy;
Regards,
Florian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would suggest to use index-based cell access to fill your intermediate table variables. This is a new feature in SPS11.
declare mytab table(i int);
mytab.i[1] = '1';
mytab.i[2] = '2';
Cheers,
Rich
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here an example :
Create COLUMN TABLE "SCHEMA"."TABLENAME"
("CUSTOMER" VARCHAR(10) PRIMARY KEY NOT NULL, NAME VARCHAR(40));
with the current syntax in the SQL script editor , a new table created with fields CUSTOMER as primary key , NAME .
Now we will fill data manually into the Table using Insert statement.
INSERT INTO "SCHEMA"."TABLENAME" VALUES ('12345', 'CUSTOMERNAME1');
INSERT INTO "SCHEMA"."TABLENAME" VALUES ('12346', 'CUSTOMERNAME2');
INSERT INTO "SCHEMA"."TABLENAME" VALUES ('12347', 'CUSTOMERNAME3');
INSERT INTO "SCHEMA"."TABLENAME" VALUES ('12348', 'CUSTOMERNAME4');
with the above statements , 4 records will be created in the HANA table .
Regards,
Kishor.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, Rich.
Now I know how to insert line into table.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, Rich.
And which variant is more faster? Union or
index-based cell access?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, Florian.
I expect to find special command, such as Append or Insert in Abap, but
apparently it is no exist
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
92 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.