Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 how to add a calculated column in a view

Author  Topic 

aomar
Starting Member

6 Posts

Posted - 2008-04-21 : 16:31:59
*first issue
how to add a calculated column in a view such that this calculated column will be calculated from the oraginal columns

create view vw1
as
select tab.col1,tab.col2 from
from tab

and i want to add a column that contains the result of a comparison between col1 and col2 (col1<col2) such that the values of the column will be true,false

thanx


jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2008-04-21 : 16:40:40
create view vw1
as
select tab.col1, tab.col2, convert(bit,case when col1<col2 then 1 else 0 end)
from tab


elsasoft.org
Go to Top of Page

aomar
Starting Member

6 Posts

Posted - 2008-04-21 : 17:36:35
thanx alot
Go to Top of Page
   

- Advertisement -