> >     I have a doubt about DEFAULT SERIAL, somewhere in the HowTo's
> > (http://www.sapdb.org/7.4/how_tos/numbergen/datentypserial_eng.htm) says
> > that you dont specify a value for a serial column in an INSERT
statement.
> > Does it mean that you SHOULD NOT specify a value, or does it only mean
that
> > if you want, you may not specify a value?
>
> It reads:
>  In the case of an INSERT statement, do not specify a value for the
>  column that has the attribute DEFAULT SERIAL. Here, the next value
[...]
>
> "Do not" is stronger than "don't"
> - actually very close to "you must not".

Yep, I know... that's the reason of my doubt.. why must i avoid specifying
values on a DEFAULT SERIAL? what's the disadvantage? or what problems could
it cause to do so...? am i breaking the number generator in any way?
For example, if a have the following:
Table: TABLE1
Columns:
    ID INTEGER DEFAULT SERIAL 1,
    VAL VARCHAR(10)

I insert 3 values ('a', 'b', 'c') and the number generator assigns the ID 1,
2 and 3 to them. Later, i insert a new value 'd' but i specify ID = 4. The
next time i insert a value without specifying the ID, which number will it
get? 5? or ill get a Duplicated primary key when it tries to assign 4?

Gonzalo

_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to