If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Microsoft SQL Server > How to add two values of computed columns?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-04-10, 00:31
HeyZain HeyZain is offline
Registered User
 
Join Date: Feb 2010
Posts: 2
How to add two values of computed columns?

Hi folks,

Could somebody guide me with example how can i add the values of two computed columns to make a third computed column?

I am using SQL Server 2005 dev. edition.

Thanks & Regards,
Zain.
Reply With Quote
  #2 (permalink)  
Old 02-04-10, 04:52
corncrowe corncrowe is offline
Registered User
 
Join Date: Aug 2004
Location: Dallas, Texas
Posts: 343
You wish to populate an existing column in a table or create a new column in an extract? Makes a difference if we knew the intended purpose and ddl or dml expectations.
Reply With Quote
  #3 (permalink)  
Old 02-04-10, 09:04
GWilliy GWilliy is offline
Registered User
 
Join Date: Jan 2003
Location: Nottinghamshire, UK
Posts: 364
You cannot make a 3rd Computed Column with the results of two existing computed columns.

BOL Says "The expression can be a noncomputed column name, constant, function, variable"

I think you'll have to recalculate/concatenate your two columns formula to make up your third

((formula1) + (formula2)) in 3rd Computed Column
__________________
"Everything should be made as simple as possible, but not simpler." - Albert Einstein
"Everything should be made as complex as possible, so I look Cleverer." - Application Developer
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On