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.
    
        
            
                
                    
                        
                            
                                | Author | 
                                
                                 Topic  | 
                             
                            
                                    | 
                                         mjimenezh 
                                        Yak Posting Veteran 
                                         
                                        
                                        81 Posts  | 
                                        
                                        
                                            
                                            
                                             Posted - 2014-06-17 : 21:02:22
                                            
  | 
                                             
                                            
                                            | Hi Everyone, I have a sql2008 view with some fields like CostPrice,ExchangeRate and Currency, I need convert all the MXN to USD so:  If the Currency = 'MXN' then Cost/ExchangeRate= USDCost but I don't know how the conditions on Sql are.Thanks in advance for your help. | 
                                             
                                         
                                     | 
                             
       
                            
                       
                          
                            
                                    | 
                                     bitsmed 
                                    Aged Yak Warrior 
                                     
                                    
                                    545 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2014-06-18 : 00:50:33
                                          
  | 
                                         
                                        
                                          Maybe this:update yourtable   set Currency='USD'      ,Cost=Cost*ExchangeRate/USD_ExchangeRate      ,ExchangeRate=USD_ExchangeRate where Currency='MXN' Replace red text with the relevant tablename and Exchange rate  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     mjimenezh 
                                    Yak Posting Veteran 
                                     
                                    
                                    81 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2014-06-18 : 10:19:00
                                          
  | 
                                         
                                        
                                          | Hi Bitsmed, if I follow your recommendation the information on my table will be changing and I don't need that, I just need calculate the USDCost to show all in USD, How can I do that?Thanks a lot.  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     bitsmed 
                                    Aged Yak Warrior 
                                     
                                    
                                    545 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2014-06-18 : 16:42:35
                                          
  | 
                                         
                                        
                                          Try this:select 'USD' as Currency      ,Cost*ExchangeRate/USD_ExchangeRate as Cost      ,USD_ExchangeRate as ExchangeRate  from yourtable where Currency='MXN'   | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                            
                                | 
                                    
                                      
                                     
                                    
                                 | 
                             
                         
                     | 
                 
             
         |