ok..reason is AnesthRisk2 is an alias given inline in same select so you can use it directly in case when. if you want to use it like that you need to first form a derived table with alias and use case over it. like below:select *, case when (AnesthRisk2 > 2) then 1, else 0end as Anesthriskfrom(Select Patienttype, DivisionCode, Substring(AnestheticRC,1,1) as AnesthRisk2from Table1)t
------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/