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  | 
                             
                            
                                    | 
                                         AskSQLTeam 
                                        Ask SQLTeam Question 
                                         
                                        
                                        0 Posts  | 
                                        
                                        
                                            
                                            
                                             Posted - 2001-03-15 : 13:09:33
                                            
  | 
                                             
                                            
                                            Mala writes "Hi,
  I have got dynamic query built as below.
  update t_inv_header1 set inv_para1="DIS",inv_per1=4,inv_para2="FGT",inv_para3="INS", inv_per3=25,inv_para4="LOC",inv_per4=2,inv_para5="TOT", inv_pamt1=160, inv_pamt2=0, inv_pamt3=0, inv_pamt4=4000-160, inv_pamt5=4000+4000-160-160+0+0, where inv_no ="PI0100001" and inv_tcode="pi1"
 
  My problem is values assinged to columns to be compued. But all these things are stored in varchar data type and not allowing me to do so.
  eg. inv_pamt4 should be "3840" instead of 4000-160
  I can't compute the values before assinging to variables b'coz I will be stuffing/replaceing the numeric fields depednign other  variable.
  Like if I got my column values like this "GRS-DIS+FGT+LOC" if will go on replacing my values for the same as below.    set @v_pexpfld = replace(@v_pExpfld1,'GRS',@v_amt)    set @v_pexpfld=replace(@v_pexpfld,'DIS',@vpexpfld)
 
 
  please help me how can I get the desired values.
  Bye,
  Mala" | 
                                             
                                         
                                     | 
                             
       
                            
                            
                                | 
                                    
                                      
                                     
                                    
                                 | 
                             
                         
                     | 
                 
             
         |   
     
     
            
              
	     |  
		
			
     
          
		 |