SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 how to add a calculated column in a view
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

aomar
Starting Member

Egypt
6 Posts

Posted - 04/21/2008 :  16:31:59  Show Profile  Reply with Quote
*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
Flowing Fount of Yak Knowledge

USA
2886 Posts

Posted - 04/21/2008 :  16:40:40  Show Profile  Visit jezemine's Homepage  Reply with Quote
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

Egypt
6 Posts

Posted - 04/21/2008 :  17:36:35  Show Profile  Reply with Quote
thanx alot
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.2 seconds. Powered By: Snitz Forums 2000