Subject | Re: [firebird-support] Cannot alter calculated field. |
---|---|
Author | Ranando King |
Post date | 2005-05-18T20:44:30Z |
Thank you. That was just enough of a clue to help me figure out what to do.
Just in case anyone else wants to know and doesn't have either time or the
funds (or both) to buy Database Workbench, here's what I did.
I first located the correct field reference in RDB$FIELDS.
Then I added a TEMP_AGE field to the table containing the correct equation.
I went back into the RDB$FIELDS table and found the record for the newly
added field.
Then I swapped the values in the RDB$FIELD_NAME column for the 2 records.
After dropping TEMP_AGE and committing the changes, everything is now
exactly what I wanted.
R.
Just in case anyone else wants to know and doesn't have either time or the
funds (or both) to buy Database Workbench, here's what I did.
I first located the correct field reference in RDB$FIELDS.
Then I added a TEMP_AGE field to the table containing the correct equation.
I went back into the RDB$FIELDS table and found the record for the newly
added field.
Then I swapped the values in the RDB$FIELD_NAME column for the 2 records.
After dropping TEMP_AGE and committing the changes, everything is now
exactly what I wanted.
R.
----- Original Message -----
From: Martijn Tonies
To: firebird-support@yahoogroups.com
Sent: Wednesday, May 18, 2005 1:35 PM
Subject: Re: [firebird-support] Cannot alter calculated field.
Hello Ranando,
> I have a field in a table defined as
>
> "Age" Computed By (Cast(((Cast('today' as Date) - "DOB")/365.25) as Int))
>
> I would like to alter it as follows:
>
> alter "Age" Type Computed By ((Cast('today' as Date) - "DOB")*4/1461)
>
> The first method keeps giving rounding errors on the result which I
assumed is because of how floating point numbers are cast into integers. The
catch is that "alter" doesn't seem to like "computed by" fields. It seems
that the only way to change this field's definition is to drop it and
re-create it. The difficulty there is that this field is used in a View
which is itself used by a lot of other objects in the database. So I cannot
drop this field without dropping and re-creating a lot of stuff. Is there
any way around this? Is there any plans on allowing "Computed By" fields to
be "Alter"ed"?
>
You might want to try Database Workbench -- via a system table
update, it allows you to "alter" computed by fields.
With regards,
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Visit http://firebird.sourceforge.net and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !
Also search the knowledgebases at http://www.ibphoenix.com
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/
To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.