title: Operand data type nvarchar is invalid for subtract operator
body: <p>I m trying to create a dynamic sql query.But in the dynamic query i couldnt figure how to use complex functions.I tried many combination but it s till giving eror.it is giving eror in the 
  column which includes RTIM LTRIM function.code and error as shown below.</p>
  
  <pre><code> declare @karorani decimal          set @karorani=0
   declare @toplamkar decimal         set @toplamkar=0
   declare @toplamciro decimal        set @toplamciro=0
   declare @odemetipi nvarchar(12)    set @odemetipi='Hepsi'
   declare  @columns nvarchar(100)    set @table='new_flightreservation'
   declare @sqlcommand nvarchar(max)  set @columns='new_salesorderid'
   declare @table nvarchar(100)       
  
    set @sqlcommand='select ' + @columns + ' from ' + @table +' M ' + 'LEFT JOIN '+
   'new_new_paymnet_'+@table +' F '+ ' on ' + ' M.'+@table+'Id'+'=F.'+@table+'Id' +
   ' left join new_payment P '+'on '+ 'F.new_paymentid=P.new_paymentId where 
   '(LTIM(RTRIM((left (P.new_name,(CHARINDEX('-',P.new_name)-1))))=@odemetipi //error 
    or @odemetipi+=Hepsi)'
  
      execute (@sqlcommand)
  
    error:  Operand data type nvarchar is invalid for subtract operator.
  </code></pre>