Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread ElevateDB Manager: Add Column Generation Options
Sat, Jul 5 2014 3:47 PMPermanent Link

Michael Riley

ZilchWorks

Avatar

I've chosen the *Generate* *As* *Identity* option. There are two other
radio buttion options:

Always
By Default Only

Always is the default selection.

What is the difference between these two options?
Why would I choose one option over the other?

Where can I find the documentation for these options?

Thanks in advance


--
Michael Riley
GySgt USMC (Ret)
www.zilchworks.com
Sun, Jul 6 2014 3:48 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Michael


Can't spot anything in the OLH but a quick web search confirms my guesses

"GENERATED ALWAYS AS IDENTITY" - Derby always provides auto-incremented sequence values to this column. You are not allowed to specify your own values.
"GENERATED BY DEFAULT AS IDENTITY" - Derby provides auto-incremented sequence values to this as default only when you are not providing values.

When you should use which is, for me, given in the definitions as well.

Roy Lambert
Sun, Jul 6 2014 5:33 AMPermanent Link

Michael Riley

ZilchWorks

Avatar

Roy Lambert wrote:

> Can't spot anything in the OLH but a quick web search confirms my
> guesses
>
> "GENERATED ALWAYS AS IDENTITY" - Derby always provides
> auto-incremented sequence values to this column. You are not allowed
> to specify your own values.  "GENERATED BY DEFAULT AS IDENTITY" -
> Derby provides auto-incremented sequence values to this as default
> only when you are not providing values.
>
> When you should use which is, for me, given in the definitions as
> well.

Thanks Roy.

Is there a reason why you picked the *Derby* search result over any of
the others?

--
Michael Riley
GySgt USMC (Ret)
www.zilchworks.com
Sun, Jul 6 2014 9:10 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Michael


>Is there a reason why you picked the *Derby* search result over any of
>the others?

Lazyness. It was the first I found that gave what I thought was a reasonable explanation.

Roy Lambert
Mon, Jul 7 2014 3:20 AMPermanent Link

Uli Becker

Michael,

in addition to Roy's answer:

when you use replication, this setting *must* be "By Default only":
otherwise a record would get a different ID (different from the source
table), when it's inserted in the target table.

Uli


Image