Unix Technical Forum

computed columns possible in informix?

This is a discussion on computed columns possible in informix? within the Informix forums, part of the Database Server Software category; --> Let's say I have two columns: AmountOne and AmountTwo. I'd like to create a column that is dynamically populated ...


Go Back   Unix Technical Forum > Database Server Software > Informix

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-20-2008, 07:49 AM
sumGirl
 
Posts: n/a
Default computed columns possible in informix?

Let's say I have two columns: AmountOne and AmountTwo. I'd like to
create a column that is dynamically populated called AmountCalc that
would subtract AmountOne from AmountTwo. Since either of the two
columns can change, AmountRemaining will always be correct. Is this
doable in IDS? I am using IDS 9.40 if that makes a difference.

I believe in MSSQL Server there is a way to define a column to do this
so that you don't have to remember to manually change the
AmountRemaining column if one of the other two values gets changed. We
are trying to reproduce the same functionality in Informix.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-20-2008, 07:49 AM
Michael Krzepkowski
 
Posts: n/a
Default Re: computed columns possible in informix?

sumGirl wrote:
> Let's say I have two columns: AmountOne and AmountTwo. I'd like to
> create a column that is dynamically populated called AmountCalc that
> would subtract AmountOne from AmountTwo. Since either of the two
> columns can change, AmountRemaining will always be correct. Is this
> doable in IDS? I am using IDS 9.40 if that makes a difference.
>
> I believe in MSSQL Server there is a way to define a column to do this
> so that you don't have to remember to manually change the
> AmountRemaining column if one of the other two values gets changed. We
> are trying to reproduce the same functionality in Informix.


Use a view.

hth

Michael
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-20-2008, 07:49 AM
Captain Pedantic
 
Posts: n/a
Default OT: Was Computed columns possible in informix?

"Michael Krzepkowski" <mkrzepkowski@hotmail.com> wrote in message
news:Pfg8d.199356$%S.181424@pd7tw2no...
> sumGirl wrote:
> > Let's say I have two columns: AmountOne and AmountTwo. I'd like to
> > create a column that is dynamically populated called AmountCalc that
> > would subtract AmountOne from AmountTwo. Since either of the two
> > columns can change, AmountRemaining will always be correct. Is this
> > doable in IDS? I am using IDS 9.40 if that makes a difference.
> >
> > I believe in MSSQL Server there is a way to define a column to do this
> > so that you don't have to remember to manually change the
> > AmountRemaining column if one of the other two values gets changed. We
> > are trying to reproduce the same functionality in Informix.

>
> Use a view.


Or get the old man to do it for you, love.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-20-2008, 07:49 AM
June C. Hunt
 
Posts: n/a
Default Re: computed columns possible in informix?

Michael Krzepkowski wrote:
> sumGirl wrote:
> > Let's say I have two columns: AmountOne and AmountTwo. I'd like to
> > create a column that is dynamically populated called AmountCalc that
> > would subtract AmountOne from AmountTwo. Since either of the two
> > columns can change, AmountRemaining will always be correct. Is this
> > doable in IDS? I am using IDS 9.40 if that makes a difference.
> >
> > I believe in MSSQL Server there is a way to define a column to do this
> > so that you don't have to remember to manually change the
> > AmountRemaining column if one of the other two values gets changed. We
> > are trying to reproduce the same functionality in Informix.

>
> Use a view.


A view would be my first choice as well. However, if you need to keep that
field for some reason, a quick, simple test with triggers (insert and
update) gave me decent results.

--
June Hunt


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:53 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com