Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 9 of 9 total
Thread Copy Generated Timestamp field
Tue, Apr 1 2008 4:52 PMPermanent Link

"Jianfei Xu"
Hi, Tim

What if I need to copy table and would like the Timestamp field value get
copied too rather than generate.
This way I can get two exactly same tables with generated timestamp field
inside of the table?

I thought I see something like disable generate field somewhere!!

Thanks

Jianfei


Tue, Apr 1 2008 5:37 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Jianfei,

<< What if I need to copy table and would like the Timestamp field value get
copied too rather than generate. This way I can get two exactly same tables
with generated timestamp field inside of the table?

I thought I see something like disable generate field somewhere!! >>

It sounds like what you want is a default value, not a generated value.

--
Tim Young
Elevate Software
www.elevatesoft.com

Tue, Apr 1 2008 6:36 PMPermanent Link

"Jianfei Xu"
Yes. I want Generated Value, when user modify records, I would like keep
tracking the lastest time the records get modified.

Only if I copy records, I would like the timestamp keep the same as the
lastest value, since the record did not change when it gets copied.

If I disable generate timestamp before I copy record, of couse, allow me to
override the timestamp field, that is what I want.

Jianfei


"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote in message
news:C5B3DC31-AF7C-4DEB-9BA3-DD21762FC87D@news.elevatesoft.com...
> Jianfei,
>
> << What if I need to copy table and would like the Timestamp field value
> get copied too rather than generate. This way I can get two exactly same
> tables with generated timestamp field inside of the table?
>
> I thought I see something like disable generate field somewhere!! >>
>
> It sounds like what you want is a default value, not a generated value.
>
> --
> Tim Young
> Elevate Software
> www.elevatesoft.com
>

Wed, Apr 2 2008 2:26 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Jianfei

From what you describe I'd suggest 1) a default value of CURRENT_TIMESTAMP and 2) an on update trigger for the field.

1) will pick up the current time when the record is created and 2) will allow you to keep it up to date when anyone changes the record.

Roy Lambert [Team Elevate]
Wed, Apr 2 2008 2:07 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Jianfei,

<< Yes. I want Generated Value, when user modify records, I would like keep
tracking the lastest time the records get modified. >>

Okay, in that case the Generated columns will work the way that you want
once the fix for 1.09 is done and we add the copying facilities in 2.0.  The
copying facilities will allow rows to be copied without causing the
generated column to be re-generated.

--
Tim Young
Elevate Software
www.elevatesoft.com

Wed, Apr 2 2008 2:51 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim

I didn't know GENERATED values would be updated when the record was which I think Jianfei is asking for.


Roy Lambert
Wed, Apr 2 2008 3:44 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< I didn't know GENERATED values would be updated when the record was which
I think Jianfei is asking for. >>

Yes, they are.  The issue is what happens with generated columns that don't
reference other columns in the table, such as what Jianfei was doing.  The
SQL standard talks about updating generated columns when referenced columns
are updated, which is what we are currently doing (and why there is a bug
for his usage), but I can't find anything yet that talks about what to do
about expressions that don't reference other columns.

--
Tim Young
Elevate Software
www.elevatesoft.com

Wed, Apr 2 2008 3:51 PMPermanent Link

"Jianfei Xu"
Thanks, Tim

Jianfei

"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote in message
news:94C295C5-B937-4463-A706-7938B5671653@news.elevatesoft.com...
> Jianfei,
>
> << Yes. I want Generated Value, when user modify records, I would like
> keep tracking the lastest time the records get modified. >>
>
> Okay, in that case the Generated columns will work the way that you want
> once the fix for 1.09 is done and we add the copying facilities in 2.0.
> The copying facilities will allow rows to be copied without causing the
> generated column to be re-generated.
>
> --
> Tim Young
> Elevate Software
> www.elevatesoft.com
>

Thu, Apr 3 2008 1:56 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim

>Yes, they are.

That's interesting and very useful.

The issue is what happens with generated columns that don't
>reference other columns in the table, such as what Jianfei was doing. The
>SQL standard talks about updating generated columns when referenced columns
>are updated, which is what we are currently doing (and why there is a bug
>for his usage), but I can't find anything yet that talks about what to do
>about expressions that don't reference other columns.

I do love standards Smiley

Roy Lambert
Image