views:

110

answers:

2

My current view produces this kind of output...

Product1 Product2
Jet      Ski
Water    Polo

Could i use a computed column in a view, in order getting results like these?

Product1 Product2 Computed
Jet      Ski      Jet Ski
Water    Polo     Water Polo
+2  A: 

Computed columns are defined at the table level, but why not simply concatenate?

SELECT 
    Product1, 
    Product2, 
    Product1 + ' ' + Product2 AS FullProductName 
FROM 
    MyProductTable
Mitch Wheat
Would the downvoter please leave a comment. Thanks.
Mitch Wheat
I think that's what he's asking, if he can do that.
T.J. Crowder
+2  A: 

Sure:

select Product1, Product2, Product1 + ' ' + Product2 as [computed]
  from my_table
Ray
Beat me by seconds. :-)
T.J. Crowder
Obviously, you need more coffee
Ray