Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Comparing Computed columns Expand / Collapse
Author
Message
Posted Wednesday, September 17, 2008 5:08 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, August 15, 2012 9:16 AM
Points: 6, Visits: 153
Hello,
I have got 2computed columns.

select * from table followed by condition as memotype1
I want to pick up my memovalue1 based on memotype1

When i did select * from where memotype=memotype1 ,it is not picking the value.

how can i compare a computed column to populate another computed column
Post #570904
Posted Wednesday, September 17, 2008 6:23 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Yesterday @ 10:40 AM
Points: 2,480, Visits: 3,023
It's a bit hard to understand your question. Can you post the complete query?

You can try to use the computed phrase to fill your column:

For instance if your computed column is like:
SELECT (Column1 + Column2) * 3 AS Computed
FROM table

instead of using this to fill another table
UPDATE table2
SET ColumnA = Computed
FROM table2 INNER JOIN table ON table1.ID = table2.ID
WHERE ...

you can use this to fill another table:
UPDATE table2
SET ColumnA = (table2.Column1 + table2.Column2) * 3
FROM table2 INNER JOIN table ON table1.ID = table2.ID
WHERE ...


** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
Post #570936
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse