Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 11 total
Thread COMPUTED & GENERATED
Thu, Jun 7 2007 9:07 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim (or anyone who knows)

Can you clarify the difference between these two "column types" for me please. Is either of them virtual so it can be used as a replacement for the calculated field event?

Roy Lambert
Thu, Jun 7 2007 9:21 AMPermanent Link

"Harry de Boer"
Roy,

The text below is from the thread that started May 19.

Regards, Harry

"
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.

"


"Roy Lambert" <roy.lambert@skynet.co.uk> schreef in bericht
news:57E93832-CFD5-4990-9ADF-A7A96B9667DB@news.elevatesoft.com...
> Tim (or anyone who knows)
>
> Can you clarify the difference between these two "column types" for me
please. Is either of them virtual so it can be used as a replacement for the
calculated field event?
>
> Roy Lambert

Thu, Jun 7 2007 9:30 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Bit more background. With an app I'm converting to MDI I'll have a mixture of a central datamodule for lookups and individual tables on forms. One of the tables (emails and other stuff) where there is a calculated field will be on many forms. At present I'm creating a calculated field and using the OnCalcFields event. I'm also using tables not queries. It would be neat it ElevateDB provided a virtual field so I could consolidate all my oncalcfields into the table itself.

Roy Lambert
Thu, Jun 7 2007 10:21 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Harry


I found and re-read that thread, but I'm not sure its doing what it says on the label.

I did a quick experiment and looked at the result in Notepad and it seemed to show that both were being stored. Hence my post. Doing another experiment it looks like neither have been stored.

I'm confused.


Roy Lambert
Thu, Jun 7 2007 12:59 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< I found and re-read that thread, but I'm not sure its doing what it says
on the label. >>

Yes, it is.  How are you testing this theory of yours ? Smiley

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, Jun 7 2007 1:00 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< Bit more background. With an app I'm converting to MDI I'll have a
mixture of a central datamodule for lookups and individual tables on forms.
One of the tables (emails and other stuff) where there is a calculated field
will be on many forms. At present I'm creating a calculated field and using
the OnCalcFields event. I'm also using tables not queries. It would be neat
it ElevateDB provided a virtual field so I could consolidate all my
oncalcfields into the table itself. >>

Use COMPUTED in that case.

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, Jun 7 2007 2:37 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim


Do a table alter, open the table, bung some data in, update, close the table and open the data portion in Notepad. First time it looked like it was being stored, second time nothing. In both cases the fields were VarChar(20) and I set the computed/generated to a string constant (which I'm not typing here cos it was rude Smiley.

Roy Lambert
Fri, Jun 8 2007 8:11 AMPermanent Link

Mauricio Campana Nonino
Tim,

<<Is either of them virtual so it can be used as a replacement for the calculated field event?>>

Would be possible to enable/disable that calculation at session level? Sometimes I need to transverse the whole table to generate a report and I
want to speed up things and such option would be very nice. Maybe, when disabled, the field could return just a null value.

Mauricio Campana Nonino
Nonino Software
Fri, Jun 8 2007 4:11 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< Do a table alter, open the table, bung some data in, update, close the
table and open the data portion in Notepad. First time it looked like it was
being stored, second time nothing. In both cases the fields were VarChar(20)
and I set the computed/generated to a string constant (which I'm not typing
here cos it was rude Smiley. >>

You'll have to be more specific - under which circumstance were you using
COMPUTED vs. GENERATED ?  IOW, if you were using GENERATED then it would be
stored, hence no surprise if it showed up in Notepad.

--
Tim Young
Elevate Software
www.elevatesoft.com

Fri, Jun 8 2007 4:15 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Mauricio,

<< Would be possible to enable/disable that calculation at session level?
Sometimes I need to transverse the whole table to generate a report and I
want to speed up things and such option would be very nice. Maybe, when
disabled, the field could return just a null value. >>

I'll have to think about this some more since the calculations are buried
deep into an abstract class and things get a little dicey once you take into
account the fact that computed columns can be indexed.

--
Tim Young
Elevate Software
www.elevatesoft.com

Page 1 of 2Next Page »
Jump to Page:  1 2
Image