Oracle中的Case与Sqlserver的Case对比

-- oracle的

   
select  t_CX_Orders. * ,
   
case   when  FIsSendMail = 1   then  FFILEPATH
                    
else   ' . '
                    
end   DownLoadPath
    
from  t_CX_Orders 
    
where  FUserID = ' AAA613 '   order   by  FInnerCode  desc

-- sqlserver的

SELECT  au_fname, au_lname, 
   
CASE  state
      
WHEN   ' CA '   THEN   ' California '
      
WHEN   ' KS '   THEN   ' Kansas '
      
WHEN   ' TN '   THEN   ' Tennessee '
      
WHEN   ' OR '   THEN   ' Oregon '
      
WHEN   ' MI '   THEN   ' Michigan '
      
WHEN   ' IN '   THEN   ' Indiana '
      
WHEN   ' MD '   THEN   ' Maryland '
      
WHEN   ' UT '   THEN   ' Utah '
        
END   AS  StateName
FROM  pubs.dbo.authors
ORDER   BY  au_lname

你可能感兴趣的:(sqlserver)