Icon View Thread

The following is the text of the current message along with any replies.
Messages 11 to 16 of 16 total
Thread GENERATED vs. COMPUTED
Mon, Mar 19 2007 6:25 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Michael,

<< What confuses me here is
<GenerationOptions> = ALWAYS AS <GenerateExpression>|

What does it suppose to be - an equivalent of COMPUTED or something entirely
different? >>

The differences between GENERATED and COMPUTED have to do with when the
expression is evaluated, and whether or not the result is actually stored in
the table.

- GENERATED columns are evaluated only during the process of an insert or
update, and only if any of the columns that are referenced in the generated
column are modified.  COMPUTED columns are updated in real-time if any of
the columns referenced in the computed column are modified.  IOW, it is safe
to use CURRENT_GUID or something similar in a GENERATED column, but using
such a function in a COMPUTED column will cause a different value to be
returned every time the computed column is re-evaluated.

- GENERATED columns are stored in the table whereas COMPUTED columns are
not.

--
Tim Young
Elevate Software
www.elevatesoft.com

Mon, Mar 19 2007 7:01 PMPermanent Link

Michael Baytalsky
Tim,

> The differences between GENERATED and COMPUTED have to do with when the
> expression is evaluated, and whether or not the result is actually stored in
> the table.
Thank you, I understand now. I was just confused because in 1.00
GENERATED ALWAYS column has been treated like COMPUTED and I thought
that you are replacing it with just a different syntax.

Regards,
Michael
Mon, Mar 19 2007 7:16 PMPermanent Link

"Ole Willy Tuv"
Tim,

<< - GENERATED columns are stored in the table whereas COMPUTED columns are
not. >>

That's a very good design/approach IMO.

Like Michael, I actually thought that GENERATED and COMPUTED were optional
keywords meaning the same thing.

Ole Willy Tuv

Tue, Mar 20 2007 4:49 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Michael,

<< Thank you, I understand now. I was just confused because in 1.00
GENERATED ALWAYS column has been treated like COMPUTED and I thought that
you are replacing it with just a different syntax. >>

Nah, I just did what you asked and made GENERATED -> COMPUTED and changed
GENERATED so that is was like the standard indicates it should be.

--
Tim Young
Elevate Software
www.elevatesoft.com

Tue, Mar 20 2007 4:51 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Ole,

<< That's a very good design/approach IMO. >>

I thought you would think so - it's the standard. Smiley

--
Tim Young
Elevate Software
www.elevatesoft.com

Tue, Mar 20 2007 5:15 PMPermanent Link

Michael Baytalsky
Tim,

> Nah, I just did what you asked and made GENERATED -> COMPUTED and changed
> GENERATED so that is was like the standard indicates it should be.
Cool, thanks!


Michael
« Previous PagePage 2 of 2
Jump to Page:  1 2
Image