Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 10 of 10 total |
Alter Column issue |
Wed, Mar 31 2010 4:21 AM | Permanent Link |
Hershcu Sorin | Hello
On my old app. I use to set the date value of a date field on run time. Now I want to modify the app. and update the field with the edb. I alter the column to generated with current_date expresion but it's modify all the previous date field values. Can I alter this column and keep the old value? Thanks Sorin |
Wed, Mar 31 2010 9:12 AM | Permanent Link |
Uli Becker | Sorin,
> Can I alter this column and keep the old value? Unless I misunderstand you: just alter the column, check "Generated", in the tab Generation check "Generate As Expression" and write "CURRENT_DATE". Then you should be done. Existing date values in the column are not concerned. Uli |
Wed, Mar 31 2010 10:03 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Uli
>Unless I misunderstand you: just alter the column, check "Generated", in >the tab Generation check "Generate As Expression" and write >"CURRENT_DATE". Then you should be done. Existing date values in the >column are not concerned. That's what I thought, but I tested in EDBManager (b9) so I could post the syntax and 1) it alters all rows to CURRENT_DATE and 2) you can't edit them. There seems to be no way to select BY DEFAULT as you can with an "autoinc" Roy Lambert [Team Elevate] |
Wed, Mar 31 2010 10:42 AM | Permanent Link |
Hershcu Sorin | "Roy Lambert" <roy.lambert@skynet.co.uk> wrote in message >
> That's what I thought, but I tested in EDBManager (b9) so I could post the > syntax and 1) it alters all rows to CURRENT_DATE and 2) you can't edit > them. There >seems to be no way to select BY DEFAULT as you can with an > "autoinc" Yes that's my problem. Any work around? Thanks Sorin |
Wed, Mar 31 2010 12:30 PM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Sorin
It depends on what you want to do. I guess from what you've posted so far you want to update the date field each time something is done to the record. If that's right then set as a standard datefield and use a before post trigger to update it. If I'm wrong can you explain what you're trying to achieve please. Roy Lambert [Team Elevate] |
Wed, Mar 31 2010 12:46 PM | Permanent Link |
Hershcu Sorin | "Roy Lambert" <roy.lambert@skynet.co.uk> wrote in message >
> It depends on what you want to do. I guess from what you've posted so far > you want to update the date field each time something is done to the > record. If that's right then set as a standard datefield and use a before > post trigger to update it. If I'm wrong can you explain what you're trying > to achieve please. Thanks Roy All I want is to alter the column of an old table. I want to alter the column to generated expresion as current_date but save the old field value of the column. Thanks Sorin |
Wed, Mar 31 2010 1:37 PM | Permanent Link |
Uli Becker | Roy,
> That's what I thought, but I tested in EDBManager (b9) so I could post the syntax and 1) it alters all rows to CURRENT_DATE I tested it as well and existing date values where not changed here (B8) and 2) you can't edit them. True. Uli |
Wed, Mar 31 2010 1:43 PM | Permanent Link |
Hershcu Sorin | "Uli Becker" <johnmuller54@googlemail.com> wrote in message >> That's what I thought, but I tested in EDBManager (b9) so I could post >> the syntax and > 1) it alters all rows to CURRENT_DATE > > I tested it as well and existing date values where not changed here (B8) > > and 2) you can't edit them. Thanks Uli Well here on ver(b9) it change all. What do you mean on edit them? Thanks Sorin |
Wed, Mar 31 2010 1:51 PM | Permanent Link |
Uli Becker | Sorin,
> All I want is to alter the column of an old table. > I want to alter the column to generated expresion as current_date > but save the old field value of the column. As Roy indicated: If you want to generate the current date with each new record, you can use a trigger "Before Insert": TRIGGER "AddDate" BEGIN Set NEWROW.MyDate = CURRENT_DATE; END If you want a change with each update of the record, you can modify the trigger and use "Before Update": Uli |
Wed, Mar 31 2010 2:00 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Sorin,
<< On my old app. I use to set the date value of a date field on run time. Now I want to modify the app. and update the field with the edb. I alter the column to generated with current_date expresion but it's modify all the previous date field values. Can I alter this column and keep the old value? >> Well, we've got an issue of "some want it this way, others want it another way": http://www.elevatesoft.com/incident?action=viewrep&category=edb&release=2.03&incident=3148 I'm inclined to lean in favor of the incident report fix, mainly because the expression is "ALWAYS AS", not "BY DEFAULT AS". What I can look into doing is adding the "BY DEFAULT AS" as an option in an upcoming release, but for now the behavior is that it will always be updated with the expression value. The only workaround that I can think of is to keep both the new generated column and the old column, and have the generated column expression be: COALESCE(OriginalColumn,CURRENT_DATE()) -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Tuesday, April 30, 2024 at 03:55 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |