Skip to Content

One sequence for several tables

Hi,

I need to use ONE sequence in the create statement for several tables (it's a partner solution, where we just want to replace the exising DB in the first step).

I created a sequence:

CREATE SEQUENCE ww_seq

START WITH 1

INCREMENT BY 1;

and then I would like to use this sequence in that way as described in the docu

create column table "bla1" (no1 integer generated by default as ww_seq.nextval, text1 varchar(10));

create column table "bla2" (no2 integer generated by default as ww_seq.nextval, text2 varchar(10));

Is this possible? If yes, what is the syntax?

thanks a lot

Wolfgang

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Mar 13, 2015 at 08:48 AM

    Hi Wolfgang,

    You can have a look at CREATE TABLE - SAP HANA SQL and System Views Reference - SAP Library, please search col_gen_as_ident

    Best regards,

    Wenjun

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 13, 2015 at 08:45 AM

    Hi Wolfgang,

    This is what I thought!

    create column table "bla1" (no1 integer generated by default as ww_seq.nextval, text1 varchar(10));

    create column table "bla2" (no2 integer generated by default as ww_seq.currentval, text2 varchar(10));

    So during next insert in "bla1", you can again call ww_seq.nextval.

    Thanks,

    Monissha

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.