2
Answers

Sum if is value varchar

Goran Bibic

Goran Bibic

6y
571
1
Sum if is value varchar...sum, iff is null to be 0
 
 
  1. select dobavljac as 'Dobavljac', SUM(isnull(cast(REPLACE(CONVERT(varchar,CONVERT(float,iznos_sa_pdv),1)), '#,0.00',''),0) AS UKUPNO)  
  2. from (select dobavljac, iznos_sa_pdv from ulazni_racun_roba_lista union all select poslovni_partner, iznos_sa_pdv from mp_ulazni_racun_ostalo_lista) as alltables   
  3. group by dobavljac 
 
 error is
 
Msg 174, Level 15, State 1, Line 1
The replace function requires 3 argument(s).
Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'as'.
 
 
Answers (2)