on 04-12-2019 9:34 AM
Hi All,
I have to create a procedure in SAP HANA where I want to generate new column named ID when i am inserting data into xyz table.
In xyz table, I have 3 columns(name,designation,location).
now when i am inserting new column "ID" should add along with name,designation,location.
Regards,
Deepthi
Hi,
I assume you are looking for an option to automatically populate unique IDs in an existing column,
please refer this blog IDENTITY column in SAP HANA
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would try to use hash_sha256 function like:
select
hash_sha256( to_varbinary(concat("NAME","DESTINATION","LOCATION") ) ) AS "UNIQUE_GUID"
from ....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
why not create the column beforehand and make it an auto increment identity via sqlscript with an alter statement. then in your stored procedure when you insert your identity would automatically increased
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Sergio Guerrero
In xyz table, I have 3 columns(name,designation,location).
Here the case is like now i just mentioned ID..But i actually needed that we need to add dynamically columns to the table for each user.
We don't know how many columns just needed to add to the table but it has to create dynamically by taking users input..
For suppose user1 want 3 columns to that table(along with name,designation,location) & user2 want 5 columns to that same table(name,designation,location)..
The procedure should be able to create those 3/5 columns on basis of users input.
Regards,
Laxmi
i there a limit of how many columns do you need to have? (i hope so) otherwise the n-user can have unlimited columns resulting in a horrible structure.... if you do have a limited number of columns structure, then why not setting it the same for all.. and only allow the users to insert/update into the number of columns allowed. this may require an additional table to control what column(s) a user may be able to interact with. just a thought
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.