Performance when comparing Varchar fields in SQL Server

0

% w / o% down is causing a lot of slowness because I use

Right(L.nrDiscado, Len(D.Descricao)) 

(I believe) to compare with the SQL field:

create table #TempNrDiscado (NrDiscado varchar(150))

Insert into #TempNrDiscado
Select distinct L.nrDiscado from #TempLigacoes L with(nolock) 
   inner join GI_Dispositivo D with(nolock) on  
      Right(L.nrDiscado, Len(D.Descricao)) = D.Descricao

Does anyone know of any way I could make this comparison?

Note: If I put a number 10 in place of D.Descricao it goes fast .

    
asked by anonymous 27.12.2016 / 13:33

1 answer

0

I solved this by having to work with some temporary tables in order to get a single value to do the JOIN instead of the Right (L.nrDiscado, Len (D.Descricao)) as said here that causes a lot of slowness. >

The question of working with the key as it has been said here is also not possible in this case, because the way information is linked is only this way.

Thank you all for the help!

    
27.12.2016 / 19:10